|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
select box List questions
I have a form that has a multiple selct box on it. I want to insert the values of each option selected into the database seperately.
Does this get passed to the next page as a comma delim list (as it does in Cold Fusion, which I am used to)? What functions should I be learning about? Does anyone have specific code example I can reference? Thanks for the patience while I learn! Brant |
|
#2
|
|||
|
|||
|
Hi!
You can name it as an array, for example: <select name="mySelect[]"> <option value="first">First</option> <option value="second">Second</option> <option value="third">Third</option> <option value="forth">Forth</option> </select> In PHP use this: <?php $howmany = count($mySelect); if($howmany > 1) { for($i = 0; $i < $howmany; $i++) { $sql = "INSERT INTO table VALUES ('" . $mySelect[$i] . "')"; } } else { $sql = "INSERT INTO table VALUES ('" . $mySelect[0] . "')"; } ?>
__________________
Regards, Ramiro Varandas Jr. |
![]() |
| Viewing: Dev Articles Community Forums > Programming > General Programming Help > select box List questions |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|