Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/232.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何在同一窗口中弹出?_Php_Forms_Popup_Contact - Fatal编程技术网

Php 如何在同一窗口中弹出?

Php 如何在同一窗口中弹出?,php,forms,popup,contact,Php,Forms,Popup,Contact,我已经设置了。下面的代码是在sendmail.php中编写的。 问题是我想在同一个窗口中弹出状态消息,比如说contact.html。它不应打开一个显示以下内容的新窗口: “感谢您与我们联系。我们将尽快与您联系” 它出现在一个新的空白窗口中,显示以下消息^^^ header('Content-type:application/json'); $status=(“感谢您联系我们。我们将尽快与您联系” ); $name=@trim(条纹斜杠($_POST['name']); $email=@tri

我已经设置了
。下面的代码是在
sendmail.php
中编写的。 问题是我想在同一个窗口中弹出状态消息,比如说
contact.html
。它不应打开一个显示以下内容的新窗口:

“感谢您与我们联系。我们将尽快与您联系”

它出现在一个新的空白窗口中,显示以下消息
^^^


header('Content-type:application/json');
$status=(“感谢您联系我们。我们将尽快与您联系”
);
$name=@trim(条纹斜杠($_POST['name']);
$email=@trim(斜杠($_POST['email']);
$product\U id=@trim(带斜杠($\U POST['product\U id']);
$phonenumber=@trim(斜杠($_POST['phonenumber']);
$quantity=@trim(斜杠($_POST['quantity']);
$subject=@trim(斜杠($_POST['subject']);
$message=@trim(带斜杠($_POST['message']);
$email_from=$email;
$email\u发送至xyz@gmail.com';
$body='Name:'$名称“\n\n”。”电邮:‘$电子邮件。“\n\n”。”产品Id:'$产品标识。“\n\n”。”联络电话:‘$电话号码。“\n\n”。“数量:”$量“\n\n”。“主题:”$主题。“\n\n”。”完整地址:'$消息。“\n\n”;
$success=@mail($email_to,$subject,$body,'From:');
echo json_编码($status);
死亡

我不知道你为什么要做
jSON
,但是如果
jSON
不是必需的:

<?php
$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";

// If main processes successfully, then continue with message    
if(@mail($email_to, $subject, $body, 'From: <'.$email_from.'>')) { ?>
    <!-- Just write normally -->
    Thank you for contacting us. As early as possible  we will contact you.
<?php die; } ?>

感谢您联系我们。我们将尽快与您联系。

在同一窗口中弹出窗口是什么意思?我猜它可能是一个看起来像弹出窗口的html元素,或者您已经有了另一个contact.html弹出窗口,您想更新它吗?
<?php
$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";

// If main processes successfully, then continue with message    
if(@mail($email_to, $subject, $body, 'From: <'.$email_from.'>')) { ?>
    <!-- Just write normally -->
    Thank you for contacting us. As early as possible  we will contact you.
<?php die; } ?>