I'm trying to check a textbox and send a different SELECT query to MySQL from PHP depending on what the user has selected from the textbox on the page. Can anyone please tell me a way I could do this?
..I mean listbox not textbox!
You really need to read the manual. This is really very basic PHP:
<? if ($listboxValue == "blah") { $query = "blah"; } elseif ($listboxValue == "blah2") { $query = "blah2"; } else { $query = "blah3"; } ?>
I know how to do if statements and queries but I don't know how to get the value from the listbox, and I'm sure $listboxvalue isn't going to retrieve the value, it's just going to make a new empty variable called $listboxvalue.
the vaulue will be stored in $HTTP_POST_VARS[name_of_the_listbox]. if it is a mulit-select listbox that var will ba an arrray where the first choice will have index 0 and so on.
Thanks Simon, that's the answer I was looking for.