Feedback


Whoops!
Please fill in all fields.
Click here to go bac to the feedback page. EOVALIDATION; } else { # all is good - we passed the empty check on all fields so add to the db $db = mysql_connect("localhost"); if (mysql_errno()) die mysql_error(); mysql_select_db("sample", $db); if (mysql_errno()) die mysql_error(); $addfeedback = sprintf("INSERT INTO feedback (user, email, spam, comments) VALUES ('%s','%s', '%s','%s')", # use sprintf to separate out the user supplied data mysql_real_escape_string($user), # and escape the data to keep the SQL safe from injections mysql_real_escape_string($email), mysql_real_escape_string($spam), mysql_real_escape_string($comments)); ; $result = mysql_query($addfeedback) or die("Cannot query the database.
" . mysql_error()); echo <<
Click here to go back to the feedback page. EOSUCCESS; } } else { # this is a GET request - do something here, or nothing, whatever you want }