Hello, here is my php code, no matter what happens it always says "All fields are required". I think that I should have a } somewhere else but I cant see where, if someone can help me with this one that would be great
<?
//initilize PHP
//convert all the posts to variables:
$pilot_id = $_POST['pilot_id'];
$callsign = "INV$pilot_id";
$origin_id = $_POST['origin_id'];
$destination_id = $_POST['destination_id'];
$duration = $_POST['duration'];
$pass = $_POST['passwor'];
if($_POST['submit']) //If submit is hit
{
//USING THE connect_db.php which connects well.
include 'connect_db.php';
if ($name == "") {
echo "All fields are required!";
} elseif ($pilot_id == "") {
echo "All fields are required!";
} elseif ($origin_id == "") {
echo "All fields are required!";
} elseif ($destination_id == "") {
echo "All fields are required!";
} elseif ($duration == "") {
echo "All fields are required!";
} else {
$query = "SELECT password FROM pilots WHERE pilot_id=$pilot_id";
$result = mysql_query($query);
$password = mysql_result($result,0,'password');
if ( $pass == "$password" ) {
//Insert the values into the correct database with the right fields
//mysql table = news
//table columns = id, title, message, who, date, time
//post variables = $title, $message, '$who, $date, $time
$result=MYSQL_QUERY("INSERT INTO reports (report_id,pilot_id,date,time,callsign,origin_id,destination_id,registration,equipment,duration,fuel,distance,fsacars_rep_url)".
"VALUES ('', '$pilot_id', '', '', '$callsign', '$origin_id', '$destination_id', '', '', '$duration', '', '', '')");
//confirm
echo "Pirep Sent!";
} else {
echo "Wrong pilot id/password!";
}
}
} else {
echo "Invalid Request!";
}
?>