Sorry RR,
I had a senior moment (didn't see the 1,2 for the pages and was posting, again, to your reply on page 2).
I took what you have and played with it:
if (isset($_POST['GradeLevel'])) {
foreach($_POST['GradeLevel'] as $grade) {
// build the string of fields to insert into
$sql_fields .= "GradeLevel" . $grade . ",";
// build your string of values to insert
$sql_values .= 'Grade '.$grade.'<br>';
}
// then trim the extra comma from the end of each string
$sql_fields = rtrim($sql_fields, ',');
$sql_values = rtrim($sql_values, ',');
// now build your query
//$sql = "INSERT INTO Forms (" . $sql_fields . ") VALUES (" . $sql_values . ")";
echo $sql_values; // to see the final query string and check the syntax is correct
} else { // this is where you code what to do if no checkbox was selected
die ('You must go back and select at least 1 Grade Level');
}
The reason was, they need the value to be Grade 7 for the 7th Grade, etc for each grade.
With that said, I can now get it to display:
Grade 7
Grade 8
Grade 9
for any check box, but I have a sql insert, later in my code for inserting all the data. I do not see how to use what i am doing with the dynamic names array you wrote.
$sql ="insert into Forms";
$sql .="(Title, FirstName, LastName, Position, SubjectTaught, GradeLevel7, GradeLevel8, GradeLevel9, Gradelevel10, GradeLevel11, GradeLevel12, School, SchoolAddress1, SchoolAddress2, City, State, Zip, EmailAddress, Washington, AmericaOne, Greed, Scaring, Freeloaders, WouldLikeBecause, PlanOnUsing, AverageStudents, VideoUse, Promise, Comments, Date, Time)";
$sql .="values('$Title', '$FirstName', '$LastName', '$Position', '$SubjectTaught', '$GradeLevel7', '$GradeLevel8', '$GradeLevel9', '$GradeLevel10', '$GradeLevel11', '$GradeLevel12', '$School', '$SchoolAddress1', '$SchoolAddress2', '$City', '$State', '$Zip', '$EmailAddress', '$Washington', '$AmericaOne', '$Greed', '$Scaring', '$Freeloaders', '$WouldLikeBecause', '$PlanOnUsing', '$AverageStudents', '$VideoUse', '$Promise', '$Comments', '$Date', '$Time')";
if(!mysql_query($sql)){
echo mysql_errno().'<br>'.mysql_error().'<br><br>';
}
I know I am close, just stuck on this last part.
Thanks for your patience, hoepfully you have an easy answer,
Don