私のエラーは何ですか?
解析エラー: 構文エラー、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);
}
?>