我的错误是什么?
解析错误:语法错误,第 14 行 public_html/sign_up.php 中的意外 T_VARIABLE
对于我的一生,我无法弄清楚我做错了什么。
include_once("../php/sign_up/connect_db.php");
// Array for JSON response
$response = array();
// Check for required fields
if (isset($_POST['firstname']) &&
isset($_POST['surname']) &&
isset($_POST['postcode']) &&
isset($_POST['email']) &&
isset($_POST['phone'])
$firstname = $_POST['firstname'];
$surname = $_POST['surname'];
$postcode = $_POST['postcode'];
$email = $_POST['email'];
$phone = $_POST['phone'];
// Connecting to db
$db = new DB_CONNECT();
// MySQL inserting a new row
$result = mysql_query("INSERT INTO TABLE 1(firstname, surname, postcode, phone, email) VALUES('$firstname', '$surname', '$postcode', '$phone', '$email')");
// Check if row is inserted or not
if ($result) {
// Successfully inserted into database
$response["success"] = 1;
$response["message"] = "Thank you for registering.";
// Echoing JSON response
echo json_encode($response);
} else {
// Failed to insert row
$response["success"] = 0;
$response["message"] = "Oops! An error occurred.";
// Echoing JSON response
echo json_encode($response);
}
}
else {
// Required field is missing
$response["success"] = 0;
$response["message"] = "Required field(s) is missing";
// Echoing JSON response
echo json_encode($response);
}
?>