我已經聯繫了......本應該將用戶重定向到「謝謝」頁面,一旦提交了相同的詳細信息;然而,在提交..用戶沒有被引導到「謝謝你」頁面。你能找出錯誤嗎?我會非常感激..非常感謝你!當我提交我的聯繫表時
<?php
include("company_profile/lib/data.config.php");
$btnsubmit =isset($_POST['btnsubmit'])?$_POST['btnsubmit']:'';
if(isset($_POST['btnsubmit']))
{
$name = $_POST['name'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$cource = $_POST['cource'];
$message = $_POST['message'];
$created_date = date('Y-m-d');
$time = date('H:i:s');
$q="Insert INTO enquiry_form SET name='$name',email='$email',
contact='$phone',message='$message',cource='$cource',
created_date='$created_date',etime='$time'";
$r = mysqli_query($conn,$q);
if($r)
{
//echo "Thankyou for Inquery";
header("location:thanks.php");
//echo "<script>alert('Message Send')</script>";
}else
{
echo "there was a problem";
}
}
?>
查詢syntaxe pb ...並看看SQL注入... https://phpdelusions.net/sql_injection – Incognito
有一件事'$ btnsubmit = isset($ _ POST ['btnsubmit'])?$ _ POST [ 'btnSubmit按鈕']: '';如果(isset($ _ POST ['btnsubmit']))'你不應該這樣做,第二;哪裏的html表單呢? –
你對SQL注入攻擊很有信心,如果你還沒有,你會被黑客攻擊**。不要將任意數據直接連接到查詢中。使用PDO或類似的綁定參數。 – Brad