November 6th, 2012, 04:43 PM
Return content to previous page
I have this problem I hope you can help me out with.
In an user registration script I check if the email is already in use. If it is not in use, continue with registration. else return to previous page(index.php)
Currently I use header(); to redirect back to the index page. But I would like to append additional html to the index page on return. Something like <h1>The email is already in use</h1>
How would I go about doing that?
BTW. I checked this post as PHP5 but it displays as PHP4 ???
November 6th, 2012, 05:11 PM
Set a message in the session. On the login page, check for the presence of that message in the session and if it's there, print it on the page.
I ♥ ManiacDan & requinix
This is a sig, and not necessarily
a comment on the OP:
don't be a help vampire
November 6th, 2012, 05:12 PM
The simple way would be to pass a value in the URL like this...
On the index.php page, look for that variable and if it is there display it. You may want to test it first but if you are just displaying it using htmlentities you should be fine regardless of what is in the message.
You can get more complex but that is the basic idea.
if(isset($_REQUEST["msg"])) echo "<h1 style='red'>".htmlentities($_REQUEST["msg"])."</h1>";
November 6th, 2012, 05:54 PM
You sure it said PHP4? It said nothing... I just changed it to PHP5 to see what would happen and that seems fine.
November 7th, 2012, 07:06 AM
Thanks guys that worked perfectly
Originally Posted by schworak