In my webpage, I ask a user to fill out a form specifying their age, race, gender, and state. Upon submission, the data is submitted to the same page and the page will process it with the following code to submit it to a database (all database login info is faked in this example):
<?php
if($_COOKIE['infoGiven']==true){
$con=mysql_connect('localhost','asasdfasd','asdf','asdfasdf');
if($_COOKIE['like']==true){
$sql="INSERT INTO LIKE(state, age, gender, race)
VALUES(\'".$_POST["state"]."\'".$_POST["age"]."\'".$_POST["gender"]."\'".$_POST["race"].")";
$con->query($sql);
}
if($_COOKIE['like']!=true){
$sql="INSERT INTO DISLIKE(state, age, gender, race)
VALUES(\'".$_POST["state"]."\'".$_POST["age"]."\'".$_POST["gender"]."\'".$_POST["race"].")";
$con->query($sql);
}
}
?>
This should simply submit the user data to the database, but instead I receive a blank page with a "500" error. There is no code inside the . Keep in mind that, prior to form submission, the page renders properly.