Registration page redirect

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mikes1471
Forum Commoner
Posts: 88
Joined: Sat Jan 24, 2009 3:29 pm

Registration page redirect

Post by mikes1471 »

Hi Everyone

I have my registration script which works fine and clears the form from the webpage and displays the paragraph "Hello (username) you have successfully registered... etc"

My problem is, if I assign a hyperlink to this message saying "click here to sign in" for example the registration page produces an error, so I thought perhaps I could display the welcome message for 5 seconds and then redirect to the login page, does anyone know how I can do this?

Any help would be much appreciated

Mike
User avatar
php_east
Forum Contributor
Posts: 453
Joined: Sun Feb 22, 2009 1:31 pm
Location: Far Far East.

Re: Registration page redirect

Post by php_east »

without seeing your registration method, i would assume you use a form with values for username/password etc, and the link does not pass these values to your login so it generates an error.

this redirection can be done by if you mimic the form values in your welcome message itself, declaring them as hidden so that the user does not see them. the presense of the values will then suppress the errors, and if they are blank, i believe your login page will prompt the user to enter them. if not, you have to modify your login to accept blanks and prompt for input.

again, this is all said without looking at the actual login mechanism. but the principle is that, yes.
watson516
Forum Contributor
Posts: 198
Joined: Mon Mar 20, 2006 9:19 pm
Location: Hamilton, Ontario

Re: Registration page redirect

Post by watson516 »

If you're getting a 404 error when you try to use the link method then you probably just need to fix the link. As for the timed redirect, use javascript.

Code: Select all

<script type="text/JavaScript">
<!--
setTimeout("location.href = 'http://www.google.ca';",1500);
-->
</script>
semlar
Forum Commoner
Posts: 61
Joined: Fri Feb 20, 2009 10:45 pm

Re: Registration page redirect

Post by semlar »

watson516 wrote:As for the timed redirect, use javascript.
No, please. No.

Code: Select all

header('refresh: 5; url=/login.php');
Post Reply