how do i create a dropdown menu?

HTML, CSS and anything else that deals with client side capabilities.

Moderator: General Moderators

Post Reply
helloise
Forum Commoner
Posts: 31
Joined: Tue Sep 21, 2010 4:20 am

how do i create a dropdown menu?

Post 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
helloise
Forum Commoner
Posts: 31
Joined: Tue Sep 21, 2010 4:20 am

Re: how do i create a dropdown menu?

Post 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>
Last edited by Benjamin on Fri Jan 07, 2011 2:09 am, edited 1 time in total.
Reason: Added [syntax=php] tags.
helloise
Forum Commoner
Posts: 31
Joined: Tue Sep 21, 2010 4:20 am

Re: how do i create a dropdown menu?

Post by helloise »

only question now is how do i het the id of the one selected from the list please???
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Re: how do i create a dropdown menu?

Post 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.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
helloise
Forum Commoner
Posts: 31
Joined: Tue Sep 21, 2010 4:20 am

Re: how do i create a dropdown menu?

Post by helloise »

thanks very much got it :)
Post Reply