當我提交表單時頁面變爲空白。提交按鈕位於表單標籤中,所有表單標籤均已就位。php頁面變爲空白
<?php
error_reporting(-1);
ini_set('display_errors', 'On');
try{
DEFINE("server_name", "localhost");
DEFINE("user_name", "ricxxstr_haris");
DEFINE("password", "Haris900");
DEFINE("db_name", "ricxxstr_pantry");
// Create connection
[email protected]_connect("localhost","ricxxstr_haris","Haris900","ricxxstr_pantry");
echo 'asd';
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
echo 'asd';
if($_SERVER['REQUEST_METHOD']=='POST'){
$firstname = $_POST['first_name'];
$lastname = $_POST['last_name'];
$age = $_POST['DOB'];
$email = $_POST['email'];
$telephone = $_POST['telephone'];
$Street_Address = $_POST['Street_Address'];
$City = $_POST['City'];
$ZIP = $_POST['ZIP'];
$State = $_POST['a'];
$Ethnicity = $_POST['b'];
$HH = $_POST['HH'];
$HH1 = $_POST['HH1'];
$HH2 = $_POST['HH2'];
$HH3 = $_POST['HH3'];
$HH4 = $_POST['HH4'];
$sql = "INSERT INTO `Visitors`
(
`first_name`,
`last_name`,
`Email_address`,
`Phone_no`,
`St_Addr`,
`city`,
`State`,
`zip`,
`age`,
`Ethnicity`,
`HH`,
`Signup_date`
) VALUES (
'$firstname',
'$lastname',
'$email',
$telephone,
'$Street_Address',
'$City',
'$State',
$ZIP,
$age,
'$Ethnicity',
$HH,
CURRENT_TIMESTAMP
)";
if (mysqli_query($conn, $sql)) {
$sql1 = "INSERT INTO `houseHold`(`Cust_id`, `0-18`, `19-54`, `55-64`, `+65`) VALUES ((SELECT `Cust_id` FROM `Visitors` WHERE `first_name`='$firstname' and `last_name` = '$lastname' and `Email_address` = '$email'), $HH1, $HH2, $HH3, $HH4)";
echo $sql1;
if (mysqli_query($conn, $sql1)) {
$Message = urlencode("Info Entered Sucessfully!");
header("Location:http://ilovetherefuge.org/?page_id=2113&Message=".$Message);
echo 'asd';
die;
}else {
echo "Error2: " . $sql1 . "<br>" . mysqli_error($conn);
}
else {
echo "Error1: " . $sql . "<br>" . mysqli_error($conn);
}
}
mysqli_close($conn);
}catch(Exception $e){
$e->getMessage();
}
?>
在我輸入第二個查詢之前,代碼運行良好。標題也適用於單個查詢。我想添加客戶的數據,然後使用相同的PHP我想添加數據與其他表中的客戶ID。
回聲「ASD 「;刪除,但不能改變 –
@johnConde我找不到它,請指導我。 –
打開錯誤報告 –