Code: Select all
<input type="checkbox" name="subject[]" value="ENG" />English
<input type="checkbox" name="subject[]" value="MATH" />Mathematics
<input type="checkbox" name="subject[]" value="SCI" />Science
<input type="checkbox" name="subject[]" value="FIL" />Filipino
<?php
//and the post data would look like
$arrSubjects = $_POST['subject'];//retruns array. Ung mga nakachecked na value na agad ung laman nito
for($i=0;$i<count($arrSubjects);$i++){
mysql_query("INSERT INTO table_name (sub) values ('".$arrSubjects[$i]."')");
}
?>
I have a problem saving that to my database if i checked it...
The Output when i look at my phpmyadmin is like this
Code: Select all
| sub |
MATH
ENG
SCI
FIL
Please help me clear myself out i'm confused ???