include ("db.inc"); define (NUMQUESTIONS, 40); // **** THIS MUST BE UPDATED TO MATCH # OF QUESTIONS! if ($submit) { // dump the data into the DB & show thank you page! $SQL = "INSERT INTO results VALUES (NULL, '$REMOTE_ADDR', now(), '$email', '$comments')"; $sql_result = mysql_query($SQL); print mysql_error(); $id = mysql_insert_id(); // Put Q&A's into answers table for ($i = 1; $i <= NUMQUESTIONS; $i++) { $ans = "q$i"; if (empty ($$ans)){ $sql = "INSERT INTO answers VALUES ($id, $i, 9)"; } else { $sql = "INSERT INTO answers VALUES ($id, $i, " . $$ans . ")"; } $sql_result = mysql_query($sql); print mysql_error(); } // Print out thank you page! ?> Thank you for filling out the survey! Now, we let you resume your scheduled Mono Programming } else { // else submit // show the form ?>
} /* end if/else */ ?>