I have a form and in that form I have a field - Subjects Taught (1, 2, 3, 4) as check boxes
When I submit the form I can get all fields but this one set up. The code I am using to insert is below
Code: Select all
// Process signup submission
dbConnect('database);
if ($_POST['newpersonalemail']=='' or $_POST['newfirstname']==''
or $_POST['newlastname']=='') {
error('One or more required fields were left blank.\\n'.
'Please fill them in and try again.');
}
// Check for existing user with the new id
$sql = "SELECT COUNT(*) FROM user WHERE userid = '$_POST[newpersonalemail]'";
$result = mysql_query($sql);
if (!$result) {
error('A database error occurred in processing your '.
'submission.\\nIf this error persists, please '.
'email.');
}
if (mysql_result($result,0,0)>0) {
error('A user already exists with your chosen newpersonalemail.\\n'.
'Please try another.');
}
$sql = "INSERT INTO user SET
userid = '$_POST[newpersonalemail]',
password = '$_POST[newpass]',
firstname = '$_POST[newfirstname]',
middlename = '$_POST[newmiddlename]',
lastname = '$_POST[newlastname]',
subtaught = '$_POST[subtaught]'
";
if (!mysql_query($sql))
error('A database error occurred in processing your '.
'submission.\\nIf this error persists, please '.
'contact you@example.com.\\n' . mysql_error());
Code: Select all
...
<tr>
<td align="right" style="vertical-align:top;"><p>Subjects Taught</p></td>
<td style="vertical-align:top;">
<input name="subtaught[]" value="Math" type="checkbox">Math<br />
<input name="subtaught[]" value="Science" type="checkbox">Science<br />
<input name="subtaught[]" value="SocialScience" type="checkbox">Social Science<br />
<input name="subtaught[]" value="LanguageArts" type="checkbox">Language Arts<br />
<input name="subtaught[]" value="Technology" type="checkbox">Technology<br />
</td>
</tr>
...
Thank you!!!!