Hi. I have made a application form for a job, I want the results the user enters into the boxes to come out into my database (evxhotel and the table apps). I get no errors and the website works perfectly fine but when I fill the form and submit the page just reloads and when I go to check my database I see that my results of the form are not in the database. I believe that maybe I put the mysql_connect and the mysql_select_db on the wrong lines.
BTW, this is only the php script embedded into a html document. The file format and name is form.php. All the tags are correct.
<?php
$connect = mysql_connect("****", "****", "****") or die(mysql_error());
if(isset($_POST['submit'])){
$username = mysql_real_escape_string($_POST['Username']);
$email = mysql_real_escape_string($_POST['Email']);
$firstname = mysql_real_escape_string($_POST['First']);
$lastname = mysql_real_escape_string($_POST['Last']);
$day = mysql_real_escape_string($_POST['Day']);
$month = mysql_real_escape_string($_POST['Month']);
$year = mysql_real_escape_string($_POST['Year']);
$time = mysql_real_escape_string($_POST['Time']);
$position = mysql_real_escape_string($_POST['Position']);
$why = mysql_real_escape_string($_POST['Why']);
$what = mysql_real_escape_string($_POST['What']);
$exp = mysql_real_escape_string($_POST['Exp']);
$hours = mysql_real_escape_string($_POST['Hours']);
$comments = mysql_real_escape_string($_POST['Comments']);
mysql_select_db($connect, "evxhotel") or die(mysql_error());
$sql = mysql_query ("INSERT INTO apps (username, email, realname, dob, time, position, why, what, exp, hours, comments) VALUES ('".$username."', '".$email."', '".$firstname/$lastname."', '".$day/$month/$year."', '".$time."', '".$position."', '".$why."', '".$what."', '".$exp."', '".$hours.", '".$comments."')", $connect);
if($sql) {
echo "Your applicaton has been added to the database.";
} else {
die(mysql_error());
}
}
?>
Whats wrong? Thanks in advance.