【发布时间】:2014-11-06 21:06:26
【问题描述】:
我已经设置了<form action="sendemail.php">。下面的代码写在sendemail.php。
问题是我希望在同一个窗口中弹出状态消息说contact.html。它不应该打开一个新窗口,上面写着:
“感谢您与我们联系。我们会尽快与您联系”
它会在一个新的空白窗口中显示此消息^^^^。
header('Content-type: application/json');
$status = ("Thank you for contacting us. As early as possible we will contact you"
);
$name = @trim(stripslashes($_POST['name']));
$email = @trim(stripslashes($_POST['email']));
$product_id = @trim(stripslashes($_POST['product_id']));
$phonenumber = @trim(stripslashes($_POST['phonenumber']));
$quantity = @trim(stripslashes($_POST['quantity']));
$subject = @trim(stripslashes($_POST['subject']));
$message = @trim(stripslashes($_POST['message']));
$email_from = $email;
$email_to = 'xyz@gmail.com';
$body = 'Name: ' . $name . "\n\n" . 'Email: ' . $email . "\n\n" . 'Product Id: ' . $product_id . "\n\n" . 'Contact Number: ' . $phonenumber . "\n\n" .'Quantity: ' . $quantity . "\n\n" .'Subject: ' . $subject . "\n\n" . 'Complete Address: ' . $message ."\n\n";
$success = @mail($email_to, $subject, $body, 'From: <'.$email_from.'>');
echo json_encode($status);
die;
【问题讨论】:
-
在同一个窗口中弹出窗口是什么意思?我猜它要么是一个看起来像弹出窗口的 html 元素,要么您已经有另一个用于contact.html 的弹出窗口,您想更新它?