无法使用 PHP 回显在 HTML 页面中发送的消息


unable to echo message sent in html page using php

我目前有这个页面,我正在处理:http://www.webauthorsgroup.com/new/template/index3.html

右下角是一个表单(php),但我无法在提交文本消息后"回显"文本消息(无论出于何种原因)。

我的表格是:

<form id="contact" method="post" action="">
<fieldset>  
<label for="name">Name</label>
<input type="text" name="name" placeholder="Full Name" title="Enter your name" class="required">
<label for="email">E-mail</label>
<input name="hidden" class="required email" onblur="if(value=='<?php echo htmlentities($_POST['email']); ?>') value = 'Your Email'" onfocus="if(value=='Your Email') value = ''" type="email" value="Your Email" placeholder="yourname@domain.com">
<label for="phone">Phone</label>
<input name="phone" onblur="if(value=='<?php echo htmlentities($_POST['phone']); ?>') value = 'phone'" onfocus="if(value=='phone') value = ''" type="tel" value="phone" placeholder="ex. (555) 555-5555">
<input type="hidden" name="phone" placeholder="ex. (555) 555-5555">
<label for="message">Question/Comment</label>
<textarea name="message" onblur="if(value=='<?php echo htmlentities($_POST['message']); ?>') value = 'message'" onfocus="if(value=='message') value = ''" value="message" placeholder="Message"></textarea>
<input type="submit" name="submit" class="button" id="submit" value="Send Message" />
</fieldset>
</form>

====

=============================================================

该过程.php是:

<?php
if(isset($_POST['submit']))
{
// Get Data 
$name = strip_tags($_POST['name']);
$email = strip_tags($_POST['email']);
$phone = strip_tags($_POST['phone']);
$url = strip_tags($_POST['url']);
$message = strip_tags($_POST['message']);
echo "Thank You!";
}
// Send Message
mail( "bruce@webauthorsgroup.com", "Inquiry From WebAuthorsGroup",
"Name: $name'nEmail: $email'nPhone: $phone'nWebsite: $url'nMessage: $message'n",
"From: Forms <forms@example.net>" );
?>

====

====================================================

提交表单后,我需要在同一div中回显的"消息已发送"文本,并且我不想将索引页面转换为索引.php

任何帮助都会很棒!

页面上

的 PHP 代码 index3.html 未被服务器上的 PHP 解释器解析或执行,因为文件扩展名.html。继续并在浏览器中查看该页面上的源代码。请注意,您可以看到 PHP 代码。您应该无法在 HTML 源代码中看到 PHP 代码。您应该只看到 PHP 呈现的 HTML。请将文件扩展名更改为.php以便您的服务器可以执行它,而不是将其输出为文本。