How can i get the data in a select-option?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
bulsecoip
Forum Newbie
Posts: 6
Joined: Thu Jun 26, 2008 12:37 am

How can i get the data in a select-option?

Post by bulsecoip »

hi, can someone help to solve this problem, i dont know how to get the data in select-option object? the code should get all the data in it.

thnx
sureshmaharana
Forum Commoner
Posts: 30
Joined: Thu Jul 03, 2008 4:20 am
Contact:

Re: How can i get the data in a select-option?

Post by sureshmaharana »

Can u explain your problem in detail.

thanks.
Brunda
Forum Newbie
Posts: 1
Joined: Wed Jul 09, 2008 5:48 am

Re: How can i get the data in a select-option?

Post by Brunda »

If its a dropdown list then

<select name="abc" />
<option value="pqr"> pqr </option>
<option value="pqr1"> pqr1 </option>
<option value="pqr2"> pqr2 </option>
</select>

if your form method is post then
$_POST['abc'] will give you the selected item in the list.

If its a multi select then
$_POST['abc'] will return an array which will contain all the selected values in the list.
Post Reply