Jump to content

Recommended Posts

hello guys

<select name="time" size="4" multiple="multiple">
	<option selected="selected">None Selected</option>
	<option>Full Time</option>
        <option>Part Time</option>
        <option>Contract</option>
        <option>Temporary</option

you know this select but who know how to enter all of selected values to database

couse when i tried to submit the form it's insert just one value from all values selected

so how can i fix it

Best Regards

A janim

Link to comment
https://forums.phpfreaks.com/topic/63374-multiple-select-and-mysql-help/
Share on other sites

the key to mutiple selects is to assign it an array name, so php interprets it as an array.

 

<select name="time[]" size="4" multiple="multiple">

 

to use those values use this simple code

 

$arr = $_POST['time'];
foreach($arr as $time){
   echo $time . "<br />";
}

thank you GuiltyGear

it works in echo $time;

but i want to send it to mysql

like this it goes nothing just one value

$insert=mysql_query("insert into $table values ('NULL', '".$_POST['time']."')")

i tried this

$insert=mysql_query("insert into $table values ('NULL', '".$time."')")

it store "array" word in database

so thank you again for your replay  :) :)

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.