Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting all selected items from multiple dropdown box 2

Status
Not open for further replies.

annasue

Technical User
Mar 20, 2004
21
US
I am VERY new to PHP but have cgi/perl experience. I have a dropdown box on my form:

<p><font face="Verdana"><small>Question 5 :</small><br>
<small><select name="champ5[]" size="2" multiple>
<option selected value="0">Choose</option>
<option value="Reponse5_1">1</option>
<option value="Reponse5_2">2</option>
<option value="Reponse5_3">3</option>
<option value="Reponse5_4">4</option>
<option value="Reponse5_5">5</option>
</select></small></font></p>

I want to be able to figure out which one or more options the user has chosen but I don't know how to get it back from the form???

Can you help?

Thanks in advance.
 
comes back as a comma separated value set

either explode it on the comma or use a foreach loop to go thru the values
 
Thank you for your reply. What is my string, coming into my file? I've tried $champ5 and that doesn't seem to be it; I also tried $champ5[] and it can't handle that???

Thanks,
Anna Sue
 
the client side element should read

<select name="champ5">

and the serverside element should read

$_POST['champ5']

the new versions of php use $_POST['varname'] and
$_GET['varname']
 
annasue:
I recommend that you continue to name your multiple SELECT tag "champ5[]". Just keep in mind that $_POST['champ5'] is itself an array containing all the values that were selected and submitted.

Want the best answers? Ask the best questions!

TANSTAAFL!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top