LIST/MENUS with multiple selection
I am building web application using Dreamweaver MX 2004, Php/MySql.
Have an INSERT page with text fields, text boxes, dropdown menus and LIST/MENU form elements.
When I want to put it in the table in MySQL database I am using Insert Recordset.
I have some doupts about LIST/MENU form element....
I need to use it in LIST MODE, for sake of using multiple selections op possible options.
Let's say, have 10 options in "list", and need to select some of them, as user wants.
User can select, for example, 3 options (not need to be consecutive) from 10 possible options using CTRL+mouse.
When form is submited in database I found only one of those 3 options, the one at the bottom of 3 selected.
Always one that is at the bottom of selected 3 or whatever is selected.
Why? There should be all 3 options in table of database, and in one field of table.
I cannot find a way to resolve this issue.
ANY IDEA WHY IT SHOULD BE LIKE THIS?
ANY HELP WOULD BE APPRICIATED.
THANK YOU.
Busy posted this at 21:53 — 15th February 2004.
He has: 6,151 posts
Joined: May 2001
are all your options named the same thing?
are you placing them in an array?
are you using this = that and this = that to or this = that and this .= that to?
have you tryed printing the insert query to the page
can we see some code or a url
Mark Hensler posted this at 02:42 — 16th February 2004.
He has: 4,048 posts
Joined: Aug 2000
When using multiple select boxes, the name of the form element should be an array...
<select name="ingredients[]" multiple size="10">
<option value="1">Peperonni</option>
<option value="2">Cheese</option>
<option value="3">Olives</option>
</select>
When multiple options are selected, the POST data will contain...
ingredients[]=1&ingredients[]=3
'Then PHP will populate an array...<?php
$_POST['ingredients'] = array(1, 3);
?>
Mark Hensler
If there is no answer on Google, then there is no question.
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.