-1

Hi, can you help me.. how to save value multiple dropdown

<select name="s1" id="s1" multiple="multiple">
<?php $sql=mysql_query("select * from setting_mp ORDER BY id_tingkat ASC");
while ($data=mysql_fetch_array($sql)){
echo "<option value=$data[id_mp]> $data[pelajaran]</option>";
} ?></select>

I wish if there are three values, then everything will go in the field
i want enter here :
table name = dbname
field name = id (autoincreament) and id_mp

4
Contributors
7
Replies
9
Views
7 Years
Discussion Span
Last Post by ivanichi
0

you mean if there are three option tag then u want to store all in db? not the selected one?
Give example here what you want...

0

example : there are five option, i want the option selected (3 option) can be enter to field.
ok, thanks for your response sir, I have found a way. :icon_smile:
just add

foreach (array_expression as $key => $value)

before sql insert

Edited by ivanichi: n/a

0

ok riskiana, thanks for your response, actually i have 45 option and I use multiple dropdown with checkboxes :)

Edited by ivanichi: n/a

0

ok riskiana, thanks for your response, actually i have 45 option and I use multiple dropdown with checkboxes :)

oh,,oke i see if u have 45 option, it's impossible to use checkboxes, not efective.
but i still not understand what's ur question?what u want ?:P

0

(@riskiana & @vaultdweller123)
++ ok friend, just look at this: http://sofanifani.com/download/jsave_dropdownlist/ if you select the option and pressing the submit button, the database will record the selected value

?? (how to save or record selected value)

** I have found a way (the problem is fix):
1. Retrieve POST data
2. Check if selections were made
3. Connect to database
4. foreach (array_expression as $key => $value)
5. sql insert.

http://sofanifani.com/download/save_dropdownlist.zip

Edited by ivanichi: n/a

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.