|
-
Jul 3rd, 2007, 03:07 AM
#1
Thread Starter
Lively Member
goto another page after updating...
i want to go to my main page (main.php) after updating my records from update page (update.php). how can i do it? please help...
ram
-
Jul 3rd, 2007, 05:14 AM
#2
Re: goto another page after updating...
You could use something like this....
PHP Code:
header("location: main.php");
-
Jul 3rd, 2007, 10:31 AM
#3
Re: goto another page after updating...
Using a header is correct.
If it's after a processing POST request, don't send any response data (make sure the PHP code starts at the very top of the file, and there is nothing being echo()'d or otherwise sent) and use a 303 redirection code to prevent the POST request from being cached by the browser:
PHP Code:
header('HTTP/1.1 303 See Other');
header('Location: main.php');
This will ensure that the back and forward controls work correctly without any irritating "This page contains POSTDATA that has expired from cache" messages.
-
Jul 4th, 2007, 07:39 PM
#4
Fanatic Member
Re: goto another page after updating...
But what about after the echoes? What if the update.php has some "Something is updated successfully!" and then pause for a moment and then redirect the the main.php? How do you guys do that?
Thanks.
-
Jul 4th, 2007, 08:47 PM
#5
Re: goto another page after updating...
You could use a refresh redirect.
HTML Code:
<!--4 = number of seconds until refresh-->
<meta HTTP-EQUIV="REFRESH" CONTENT="4; URL=main.php">
EDIT: So i did Dclamp
Last edited by lintz; Jul 6th, 2007 at 06:18 PM.
-
Jul 5th, 2007, 08:16 PM
#6
Re: goto another page after updating...
@Lintz: you used a Visual Basic comment,
php comment is:
PHP Code:
//blah OR:
/* blah */
or html comment:
HTML Code:
<!-- Comment -->
My usual boring signature: Something
-
Jul 5th, 2007, 10:24 PM
#7
Re: goto another page after updating...
You should have it set to HTML code, and have the HTML comment since META is HTML not PHP 
come one, you know better, your smarter then that :P
if your problem is resolved, please select "Thread Tools > Set as Resolved", and give rep accordingly
My usual boring signature: Something
-
Jul 6th, 2007, 03:13 AM
#8
Re: goto another page after updating...
Can't you see I did a bit of both, just like in your post
-
Jul 6th, 2007, 01:55 PM
#9
Re: goto another page after updating...
well now it looks like a child wrote that code. here, make it like this:
HTML Code:
<!-- 4 = number of seconds until refresh -->
<meta HTTP-EQUIV="REFRESH" CONTENT="4; URL=main.php">
My usual boring signature: Something
-
Jul 6th, 2007, 04:37 PM
#10
Re: goto another page after updating...
Oh please, Dylan! The thread starter hasn't even responded yet.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|