This is the code for the form input:
<select name="grades" size="5" multiple id="grades">
<option value="Pre K">Pre K</option>
<option value="Kindergarten">Kindergarten</option>
<option value="1st">1st</option>
<option value="2nd">2nd</option>
<option value="3th">3rd</option>
<option value="4th">4th</option>
<option value="5th">5th</option>
<option value="6th">6th</option>
<option value="7th">7th</option>
<option value="8th">8th</option>
<option value="9th">9th</option>
<option value="10th">10th</option>
<option value="11th">11th</option>
<option value="12th">12th</option>
</select>
Since there is an option to select multiple answers, I would like for all of the answers to be recorded in the database however, the only answer it posts it the last of the group. for example say 6th, 7th, and 8th were all selected. When the form is submitted, only "8th" gets posted to the correct field. Does that make sense?
Use array. Ie.,
<select name="grades[]" size="5" multiple id="grades">
Then, as usual, use
foreach($_POST['grades'] as $value) to get each of the selected value.
Last edited by peter_budo; Apr 18th, 2009 at 4:51 am. Reason: Correcting closing tag
Moderator
Featured Poster
Reputation Points: 524
Solved Threads: 356
Purple hazed!
Offline 3,878 posts
since Nov 2007