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 i wan't to do is when i check 2 or more checkbox and click button submit it will save the value of the checked checkbox in my database using php. (php code below)
if(isset($_POST['btnSubmit']))
{
$OptionTrack = $_POST['track'];
for ($i=0; $i<sizeof($OptionTrack);$i++)
{
$SqlQ_T = "INSERT INTO question_track_table (Track_ID) values ('$OptionTrack[$i]');";
mysqli_query($con,$SqlQ_T);
}
echo "<script>alert('Added!');</script>";}
Note : I want to save every checkbox value in defferent rows in the database not put all values in one column. Thanks in advance :)
Aucun commentaire:
Enregistrer un commentaire