If redirected from page **** then echo "message"

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

If redirected from page **** then echo "message"

Post by mikes1471 »

Hi Everyone

I have created a registration and a login script now and have the registration page redirect to the login page after registration has been completed.

What I want is - if the user has been redirected from registration.php then echo "Welcome, you have successfully registered"

What do I write to influence this?

Mike
braveryonions
Forum Newbie
Posts: 14
Joined: Wed Feb 11, 2009 3:31 pm

Re: If redirected from page **** then echo "message"

Post by braveryonions »

You could check to see if a $_POST or $_GET variable is set, and choose to display the message from that.
User avatar
jackpf
DevNet Resident
Posts: 2119
Joined: Sun Feb 15, 2009 7:22 pm
Location: Ipswich, UK

Re: If redirected from page **** then echo "message"

Post by jackpf »

The way I would do it is

Code: Select all

 
<?php
    //note that $_SERVER[HTTP_REFERER] also includes any variables in the url, eg ?id=34
    if($_SERVER[HTTP_REFERER] == 'register.php')
    {
        echo 'Welcome, you have successfully registered...';
    }
?>
 
Post Reply