NYCPHP Meetup

NYPHP.org

[nycphp-talk] auto generate select tag in html

Alvaro P. apg88zx at gmail.com
Tue Feb 27 16:13:56 EST 2007


I think this is what you mean:

echo "<select name=\"list\">\n";
foreach ($list_items as $item) {
    echo "<option value=\"$item\">$item</option>\n";
}
echo "</select>";


-Alvaro

selyah wrote:
> Hello all:
> i am designing a form in php and it combines HTML, I have not program 
> in HTML in a while and need a refresher, but i am hoping that someone 
> can help me with this simple issue.
> I just need to know the syntax to get the <select></select> tag in 
> HTML to auto generate a list when new <option></option>'s are created.
> in other words as the options get created from a form in php, another 
> form  where the select tag is located will have the new items.
> thanks in advance
> ------------------------------------------------------------------------
>
> _______________________________________________
> New York PHP Community Talk Mailing List
> http://lists.nyphp.org/mailman/listinfo/talk
>
> NYPHPCon 2006 Presentations Online
> http://www.nyphpcon.com
>
> Show Your Participation in New York PHP
> http://www.nyphp.org/show_participation.php




More information about the talk mailing list