mysql - php - Save all checked checkbox in the database using php -


i have 4 checkboxes (html code below)

<input id="check1" type="checkbox" name="track[]" value="1">abm <input id="check2" type="checkbox" name="track[]" value="2">stem <input id="check3" type="checkbox" name="track[]" value="3">humss <input id="check4" type="checkbox" name="track[]" value="4">gas 

what wan't when check 2 or more checkbox , click button submit save value of checked checkbox in database using php. (php code below)

if(isset($_post['btnsubmit'])) { $optiontrack = $_post['track']; ($i=0; $i<sizeof($optiontrack);$i++)          {             $sqlq_t = "insert question_track_table (track_id) values ('$optiontrack[$i]');";             mysqli_query($con,$sqlq_t);         } echo "<script>alert('added!');</script>";} 

note : i want save every checkbox value in defferent rows in database not put values in 1 column. in advance :)


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -