janim Posted August 5, 2007 Share Posted August 5, 2007 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 Quote Link to comment https://forums.phpfreaks.com/topic/63374-multiple-select-and-mysql-help/ Share on other sites More sharing options...
Fadion Posted August 5, 2007 Share Posted August 5, 2007 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 />"; } Quote Link to comment https://forums.phpfreaks.com/topic/63374-multiple-select-and-mysql-help/#findComment-315869 Share on other sites More sharing options...
janim Posted August 5, 2007 Author Share Posted August 5, 2007 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 :) Quote Link to comment https://forums.phpfreaks.com/topic/63374-multiple-select-and-mysql-help/#findComment-315886 Share on other sites More sharing options...
Fadion Posted August 5, 2007 Share Posted August 5, 2007 You want to put those values in different rows or altogather in the same row, maybe seperated by commas? Quote Link to comment https://forums.phpfreaks.com/topic/63374-multiple-select-and-mysql-help/#findComment-315891 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.