Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/280.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 - Fatal编程技术网

Php 如何添加一个“;“已发送消息”;表单提交后显示的页面顶部的消息(现在不显示)?

Php 如何添加一个“;“已发送消息”;表单提交后显示的页面顶部的消息(现在不显示)?,php,Php,如何在提交表单后显示的页面顶部添加“已发送消息”消息(现在不显示)?以下是php文件:- <? ob_start(); function clean_string($string) { $bad = array("content-type","bcc:","to:","cc:","href"); return str_replace($bad,&qu

如何在提交表单后显示的页面顶部添加“已发送消息”消息(现在不显示)?以下是php文件:-

    <? ob_start(); 
    function clean_string($string) {
      $bad = array("content-type","bcc:","to:","cc:","href");
      return str_replace($bad,"",$string);
    }
require("class.phpmailer.php");
$email = "dr_ramanand@rediffmail.com";
$subject="Quick Response";
    
    $email_message .= "Name: ".clean_string($_POST['name'])."\n";
    $email_message .= "Phone: ".clean_string($_POST['phone'])."\n";
    $email_message .= "Email: ".clean_string($_POST['email'])."\n";
    
    $email_message .= "Address: ".clean_string($_POST['address'])."\n";
    
    $email_message .= "Subject: ".clean_string($_POST['subject'])."\n";
    $email_message .= "Comments: ".clean_string($_POST['comments'])."\n";
    $email_message .= "Keywords: ".clean_string($_POST['keywords'])."\n";
$headers  = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "From: ".$from_email."\r\n";
$mail = new PHPMailer();
$mail->From     = "dr_ramanand@rediffmail.com";
$mail->FromName = "Cure4incurables";
$mail->Subject =  $subject;
$mail->Body    = $email_message;
$mail->AltBody = "";//$text_body;
$mail->AddAddress($email,$name);
$mail->IsHTML(true);
if(!$mail->Send())
{
}
header("location: https://www.cure4incurables.in/Contact_Us.html");//echo "Message Sent!"; 
?>
  <? ob_flush(); ?>

最简单的方法是向目标位置添加GET变量,并将此目标文件从html更改为php:

header("location: https://www.cure4incurables.in/Contact_Us.php?sent=1");
在联系_Us.php时,您可以这样做

if (isset($_GET['sent'])) {
 echo "Thank you for contacting us";
}

最简单的方法是向目标位置添加GET变量,并将此目标文件从html更改为php:

header("location: https://www.cure4incurables.in/Contact_Us.php?sent=1");
在联系_Us.php时,您可以这样做

if (isset($_GET['sent'])) {
 echo "Thank you for contacting us";
}

这是查询表单所在地的url:这是查询表单所在地的url:只需添加
?sent=1
将GET变量添加到目标位置,对吗?我照你说的做了,甚至创建了Contact_Us.php文件,并添加了你告诉我的内容,但在提交表单后,“感谢联系我们”的消息不会显示出来!仅供参考,我不是开发人员。你能发布Contact_Us.php的内容吗?或者至少第一部分和包括我脚本的部分?作为旁注:在文件名中使用大写和小写字母时要小心。Unix系统区分大小写,而Windows系统则不区分大小写。虽然没有必要,但我建议只使用小写字母作为文件名,因为这通常会导致错误,当您不需要额外注意时,您是否上载了带有更改的脚本?因为当我提交带有您发布的链接的表单时,我被禁止联系_Us.html,而不是联系_Us.php?sent=1。在您的表单(enquiry.html)中,将
http
此处
替换为
https
,以便通过安全连接发送表单。我需要专业人员来完成此操作。无论如何,谢谢你的帮助!只需添加
?sent=1
即可将GET变量添加到目标位置,对吗?我照你说的做了,甚至创建了Contact_Us.php文件,并添加了你告诉我的内容,但在提交表单后,“感谢联系我们”的消息不会显示出来!仅供参考,我不是开发人员。你能发布Contact_Us.php的内容吗?或者至少第一部分和包括我脚本的部分?作为旁注:在文件名中使用大写和小写字母时要小心。Unix系统区分大小写,而Windows系统则不区分大小写。虽然没有必要,但我建议只使用小写字母作为文件名,因为这通常会导致错误,当您不需要额外注意时,您是否上载了带有更改的脚本?因为当我提交带有您发布的链接的表单时,我被禁止联系_Us.html,而不是联系_Us.php?sent=1。在您的表单(enquiry.html)中,将
http
此处
替换为
https
,以便通过安全连接发送表单。我需要专业人员来完成此操作。无论如何,谢谢你的帮助!