Hi guys,
Not sure my if statement is working it suppoosed to check that all certain fields are filled in before they are insterted in ot the database but it doesn't.
here is my code
can anyone see anything wrong. I can just put the forename in my form and submit it and it thanks me for submitting my details. It shouldnt do this.
<?php
// create short variable names
$forename=$POST['forename'];
$surname=$POST['surname'];
$age=$POST['age'];
$telephonenumber=$POST['telephonenumber'];
$email=$_POST['email'];
("$POST[forename]<br>$POST[surname]<br>$POST[age]<br>$POST[telephonenumber]<br>$_POST[email]");
if ((isset($POST['forename'])) && (isset($POST['surname'])) && (isset($POST['age'])) && (isset($POST['telephonenumber'])) && (isset($POST['email'])) )
{
$forename = addslashes($POST['forename']);
$surname = addslashes($POST['surname']);
$age = addslashes($POST['age']);
$telephonenumber = addslashes($POST['telephonenumber']);
$email = addslashes($POST['email']);
mysql_connect('localhost', 'phpuser', 'phpuser03')or die ("Database connection error");
mysql_select_db('booking');
$result = mysql_query("INSERT INTO customer (forename, surname, age, telephonenumber, email)
VALUES('$forename', '$surname', '$age', '$telephonenumber', '$email')")
OR DIE("Unable to insert record. Error: ".mysql_error());
print("Your record has been successfuly inserted.");
}else{
print("You have not entered all the required details.<br/> Please go back and try again.");
}
?>