Page 1 of 1

how do i create a dropdown menu?

Posted: Thu Jan 06, 2011 2:48 am
by helloise
how do i this? i have no idea....i need to incorporate it on an html form
pleas help?

i will get the data from this line(php) and must be able to select one from the dropdown and get the id/name from the one selected

$supplier_names = LpmAdnetworkPeer::getByName($catcher_id);

thank you

Re: how do i create a dropdown menu?

Posted: Thu Jan 06, 2011 3:07 am
by helloise
sorted...

Code: Select all

 <td width='100px'>Suppliers
              
                <select>
                    <?php
                       $catcher_id = $service->getCatcherId();
                       $supplier_names = LpmAdnetworkPeer::getByName($catcher_id);
                       foreach($supplier_names as $row) 
                       { 
                           ?>
                           <option><?php echo $row->getName();?></option>
                    <?php      
                       }
                    ?>
                </select>
                </td>

Re: how do i create a dropdown menu?

Posted: Thu Jan 06, 2011 3:18 am
by helloise
only question now is how do i het the id of the one selected from the list please???

Re: how do i create a dropdown menu?

Posted: Thu Jan 06, 2011 4:06 pm
by pickle
Give your <select> a "name" attribute (<select name = "suppliers">), and each <option> a "value" attribute (<option value = "12">). Then when the form is submitted, $_POST['suppliers'] will equal 12 (or whatever option is selected when the form is submitted).

Do a google search for HTML select box & you should get some pages giving your more details on how they work.

Re: how do i create a dropdown menu?

Posted: Wed Jan 12, 2011 8:17 am
by helloise
thanks very much got it :)