开发者

Redirecting form to the index page

开发者 https://www.devze.com 2023-04-11 14:51 出处:网络
I have seat reservation page, when user clicks a seat, she write information and save it, after saving, she will be directed to update.php. But in update.php there is a button for index page,开发者_如

I have seat reservation page, when user clicks a seat, she write information and save it, after saving, she will be directed to update.php. But in update.php there is a button for index page,开发者_如何学运维 I just wanted to enter user information to the database.

Instead of clicking "go to index" in update.php, how should I redirect users to index.php after action.php

Link is: http://orhancanceylan.com/sgkm/


Try this.

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

More info: http://php.net/manual/en/function.header.php *Read the warning.


To answer your question specifically, you should add this to your php:

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

But beware: you should do this at start of the script before any content is written to your page.

Another way to do so is to merge index.php and update.php and check at start of the script if something is posted (this is an update) or not (this is just index). No need to redirection then and your page can be easily moved elsewhere in a more portable way.


Is this what you are looking for?

header('Location: index.php');
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号