-1
我創建了一個表單,可以正常運行,但是無論用戶嘗試註冊並使用肥大,它都不會反映在數據庫中,也不會顯示錯誤的子句。Php表格錯誤肥厚
示例 買方全名:Tina's Place。
代碼
<form method='post' action='' enctype='multipart/form-data' id='payment_section'>
<input type='text' name='buyer_name' placeholder='Buyer Full Name' style='width:100%;' required><br>
<input type='text' name='email' placeholder='Email Address' style='width:100%;' required><br>
<input type='text' name='phone_num' placeholder='Phone Number' style='width:100%;font-family:sans-serif;' required><br>
<input type='text' name='couple_name' placeholder='Full Name of either Bride or Groom' style='width:100%; color:#646464;' required>
<textarea name='good_will' placeholder='Goodwill Message (Optional)' class='form-control' style='margin-bottom:20px; width:100%;' rows='3'></textarea>
<button id='sub_btn' type='submit' name='order' style='margin-top:10px;'>Order</button>
</form>
PHP代碼
<?php
if(isset($_POST['order'])){
$buyer_name = $_POST['buyer_name'];
$email = $_POST['email'];
$phone_num = $_POST['phone_num'];
$couple_name = $_POST['couple_name'];
$good_will = $_POST['good_will'];
$order_gift = "INSERT INTO payment_order(buyer_name,email,phone_num,couple_name,good_will,address,pro_title,pro_price,vendor) VALUES ('".$buyer_name."','".$email."','".$phone_num."','".$couple_name."','".$good_will."','Payment Online','".$pro_title."','".$pro_price."','".$pro_vendor."')";
$run_me = mysql_query("$order_gift");
//$to= ''.$email.'';
$to = '[email protected]';
$subject = 'Product Order';
// message
$message = '
Gift Registry order: "'.$pro_title.'", Gift for: "'.$couple_name.'", Name: "'.$buyer_name.'", Address: Deliver to couple, Email- "'.$email.'", Phone Number- "'.$phone_num.'".
';
if (mail($to, $subject, $message)){
echo "<script>alert('You have successfully ordered for this gift item.')</script>";
echo "<script>window.close('index.php','_self')</script>";
}
else{
echo "<script>alert('Error')</script>";
}
}
?>
感謝您通知@u_mulder,它已被更正 –