Click to See Complete Forum and Search --> : Geting Vars from dropdown menu?


sciguyryan
08-15-2004, 09:40 AM
Can someone please explain how you can get variables from dropdown menus using PHP?

Sorry, I'm still new and don't quite get this part.


Thanks for the help,


- RyanJ

Ben Rogers
08-15-2004, 10:50 AM
Do you mean how does it get the information from a <select> element within a form? Please clarify.

sciguyryan
08-15-2004, 10:59 AM
Originally posted by omega
Do you mean how does it get the information from a <select> element within a form? Please clarify.


Sorry, my ad I should have been more clear.

What I meant was how can I get the option the user selected and echo the result?

Ben Rogers
08-15-2004, 11:15 AM
<form ...
<select name="foo">
<option value="lorem">Lorem</option>
<option value="ispum">Ipsum</option>
</select>
...</form>

echo $_POST['foo']; // echoes value of selected option

Just an example... if you need more detail, ask. :)

sciguyryan
08-15-2004, 11:19 AM
Originally posted by omega

<form ...
<select name="foo">
<option value="lorem">Lorem</option>
<option value="ispum">Ipsum</option>
</select>
...</form>

echo $_POST['foo']; // echoes value of selected option

Just an example... if you need more detail, ask. :)

Nope, thats great...

I was thinking of something a lot more complicated to get the values, I did not know it was nearly the same as getting values from a text box.


Thanks you for your help,

- RyanJ

Ben Rogers
08-15-2004, 11:25 AM
No problem :)