php菜鸟,大家帮忙看看

lihorse_1043 2010-09-30 06:18:11
下面是发送邮件的一段代码,发送没有问题。可是发送完之后显示
***********************
404 NOT FOUND
Sorry, but you are looking for something that isn't here.

Search Our Site:
Search for:

10 Most Recent Posts
Search by Month:
Search by Category:
No categories
***********************
如何我才能让他发送完返回到首页
谢了先
***********************
<?php
if (isset($_REQUEST['email']))
{
$name = $_REQUEST['name'];
$email = $_REQUEST['email'];
$subject = $_REQUEST['subject'];
$message = $_REQUEST['message'];
mail( "x.w.kane@hotmail.com", "Subject: $name", $message, "From:$email" );
echo "Thank you for mailing us"; }
else
{
echo "<form method='post' action='send.php'>
Name: <input name ='name' type='text' /><br />
Email : <input name='email' type='text' /><br />

Message:<br />
<textarea name='message' rows='10' cols='30'>
</textarea><br />
<input type='submit' /> </form>";
}
?>
...全文
83 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
lihorse_1043 2010-09-30
  • 打赏
  • 举报
回复
呵呵,谢了,十分感谢楼上的,用header不行。用echo可以。没问题了。
结贴了。
kyzy_yy_pm 2010-09-30
  • 打赏
  • 举报
回复
将echo "Thank you for mailing us";换成header('location:http://www.baidu.com');或者echo '<script>location.href = "http://www.baidu.com";</script>';不行么?
lihorse_1043 2010-09-30
  • 打赏
  • 举报
回复
我是在sidebar里边加的这段code,不是一个完整的文件。
试了楼上的方法,还是不行。没有什么简单的语句,让它提交完之后就跳转到首页上?
www.healthmanukahoney.com是我的网站,右边sidebar里边就是我加的代码。提交没问题,就是提交之后报错。
有兴趣的兄弟姐妹可以看一下,帮忙改改。
kyzy_yy_pm 2010-09-30
  • 打赏
  • 举报
回复
请在文件的最前端加上ob_start()才可以在header有输出动作,或者用
echo '<script>location.href = "首页地址";</script>';
kyzy_yy_pm 2010-09-30
  • 打赏
  • 举报
回复

echo "Thank you for mailing us";
header("Location: http://首页网址");

deader前面是不能有任何的输出的
lihorse_1043 2010-09-30
  • 打赏
  • 举报
回复
谢了,楼上的。不过我试了,还是不行啊,是不是因为我用的是wordpress的原因
Warning: Cannot modify header information - headers already sent by (output started at /home/kane1994/public_html/wp-content/plugins/all-in-one-seo-pack/aioseop.class.php:221) in /home/kane1994/public_html/wp-content/plugins/exec-php/includes/runtime.php(42) : eval()'d code on line 10
cent_50 2010-09-30
  • 打赏
  • 举报
回复

<?php
if (isset($_REQUEST['email']))
{
$name = $_REQUEST['name'];
$email = $_REQUEST['email'];
$subject = $_REQUEST['subject'];
$message = $_REQUEST['message'];
mail( "x.w.kane@hotmail.com", "Subject: $name", $message, "From:$email" );
echo "Thank you for mailing us";
header("Location: http://首页网址");
}
else
{
echo "<form method='post' action='send.php'>
Name: <input name ='name' type='text' /><br />
Email : <input name='email' type='text' /><br />

Message:<br />
<textarea name='message' rows='10' cols='30'>
</textarea><br />
<input type='submit' /> </form>";
}
?>

21,886

社区成员

发帖
与我相关
我的任务
社区描述
从PHP安装配置,PHP入门,PHP基础到PHP应用
社区管理员
  • 基础编程社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧