将表单重定向到索引页面

时间:2011-10-09 16:09:32

标签: php forms redirect

我有座位预订页面,当用户点击座位时,她会写信息并保存, 保存后,她将被引导至update.php。但是在update.php中有一个索引页面按钮,我只想将用户信息输入数据库。

而不是点击update.php中的“转到索引”,如何在action.php之后将用户重定向到index.php

链接是:http://orhancanceylan.com/sgkm/

3 个答案:

答案 0 :(得分:2)

试试这个。

//this will redirect the users after action.php...
//Put this after what you want to do.
header('Location: index.php');

更多信息: http://php.net/manual/en/function.header.php *阅读警告。

答案 1 :(得分:0)

这是你在找什么?

header('Location: index.php');

答案 2 :(得分:0)

要具体回答你的问题,你应该把它添加到你的php:

<?php
header( 'Location: http://www.yoursite.com/new_page.html' ) ;
?>

但要注意:在将任何内容写入页面之前,您应该在脚本开始时执行此操作。

另一种方法是合并index.php和update.php并在脚本开始时检查是否发布了某些内容(这是更新)(这只是索引)。无需重定向,您的页面可以通过更便携的方式轻松移动到其他位置。

相关问题