感谢页面中表格结果中的地点名称?
我设计了一个表格,在提交后通过电子邮件发送结果。成功后,PHP 脚本将显示感谢页面。是否可以将“姓名”字段放在单独的感谢页面中?
这是我的表单代码:
<?php
$name = $_REQUEST['name'] ;
$carenumber= $_REQUEST['carenumber'] ;
$email = $_REQUEST['email'] ;
$topic = $_REQUEST['topic'] ;
$message = $_REQUEST['message'] ;
$Body = "";
$Body .= "Name: ";
$Body .= $name;
$Body .= "\n";
$Body .= "\n";
$Body .= "Caregiver Number: ";
$Body .= $carenumber;
$Body .= "\n";
$Body .= "\n";
$Body .= "Email Address: ";
$Body .= $email;
$Body .= "\n";
$Body .= "\n";
$Body .= "Topic: ";
$Body .= $topic;
$Body .= "\n";
$Body .= "\n";
$Body .= "Message: ";
$Body .= $message;
$Body .= "\n";
mail( "[email protected]", "Message From Myorphan.com Contact Page",
$Body, "From: $email" );
header( "Location: http://www.feedmyorphan.com/contact_confirm.htm" );
?>
I designed a form that emails the results when submitted. The PHP script will show a thank you page upon success. Is it possible to place the the "name" field in a separate thank you page?
Here is my code for the form:
<?php
$name = $_REQUEST['name'] ;
$carenumber= $_REQUEST['carenumber'] ;
$email = $_REQUEST['email'] ;
$topic = $_REQUEST['topic'] ;
$message = $_REQUEST['message'] ;
$Body = "";
$Body .= "Name: ";
$Body .= $name;
$Body .= "\n";
$Body .= "\n";
$Body .= "Caregiver Number: ";
$Body .= $carenumber;
$Body .= "\n";
$Body .= "\n";
$Body .= "Email Address: ";
$Body .= $email;
$Body .= "\n";
$Body .= "\n";
$Body .= "Topic: ";
$Body .= $topic;
$Body .= "\n";
$Body .= "\n";
$Body .= "Message: ";
$Body .= $message;
$Body .= "\n";
mail( "[email protected]", "Message From Myorphan.com Contact Page",
$Body, "From: $email" );
header( "Location: http://www.feedmyorphan.com/contact_confirm.htm" );
?>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您需要将感谢页面设为 PHP 页面(使用 .php 扩展名),然后在您提供的此代码示例的标头中放置:
然后,在感谢页面上使用
页面上的任何位置。
You would need to make the thank you page a PHP page (using the .php extension), then, in your header in this code sample you have provided, place:
Then, on the thank you page, use
<?php echo $_GET['name'] ?>
anywhere on the page.如果我理解正确的话...
...尝试将名称字段设置为 $_SESSION 变量,并通过感谢页面上的 $_SESSION 访问它。
If I understand you correctly...
...try setting the name field as a $_SESSION variable, and accessing it through $_SESSION on the thank you page.
是的,您需要使用 SESSIONS 并使用 PHP 将 cookie 数据发送到第二个脚本。这是使用 cURL 的示例。
然后,在第二个脚本中,调用会话并回显会话变量。
此外,请务必验证和清理您的输入,以确保提交的数据尽可能准确。
Yes, you need to use SESSIONS and send the cookie data to the second script using PHP. Here is an example using cURL.
Then, in your second script, call for the session and echo the session variable
Also, be sure to validate and sanitize your input to ensure the data being submitted is as accurate as possible.