I have a form with method = post submitting to a form handler file which is writing the post to a DB and then emailing the result to a user.
I have written an insert statement but when the form is being processed I'm getting an error, but not being a DB whiz I'm not really sure what the problem is. Here's the code--
// MYSQL QUERY
$result = mysql_query("INSERT INTO 2009_prize_results (name, address, address2, email, 100, 101, 102, 103, 104, 105, 106, 107, 108) VALUES ($_POST[name],$_POST[address],$_POST[address2],$_POST[email],$_POST[100],$_POST[101],$_POST[102],$_POST[103],$_POST[104],$_POST[105],$_POST[106],$_POST[107],$_POST[108])");
if (!$result) {
die ("SQL error: " . mysql_error());
}
And the error I'm getting is--
SQL error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '100, 101, 102, 103, 104, 105, 106, 107, 108) VALUES (Marty Martin,313 Orlando Av' at line 1
The submission values were
name = Marty Martin
address = 313 Orlando Ave
address2 = Anytown, VA
email = [email protected]
100 = on
101 = off
10* are all checkboxes so are either on or off
What do I have wrong here?