Help redirecting URL based on user's input...

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
surreylee
Forum Newbie
Posts: 2
Joined: Mon Feb 10, 2014 7:01 pm

Help redirecting URL based on user's input...

Post by surreylee »

I am trying to re-direct users to specific URLs depending on their input from another page. Code listed below:

<?php
$user1=999;
$user2=100;
$user3=200;

$account=$_POST["account"];

if ($account==$user1)
{
header ('Location: /support.html');
exit;
}
elseif ($account==$user2)
{

header('Location: /services.html');
exit;
}
elseif ($account==$user3)
{
header('Location: /about.html');
exit;
}
else
{
echo "this don't work";
}
?>

I have also tried ('Location: http://mydomain.com/about.html'); and to no avail.
Last edited by surreylee on Mon Feb 10, 2014 8:02 pm, edited 1 time in total.
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: Help redirecting URL based on user's input...

Post by Celauran »

And? What happens?
surreylee
Forum Newbie
Posts: 2
Joined: Mon Feb 10, 2014 7:01 pm

Re: Help redirecting URL based on user's input...

Post by surreylee »

It just goes to a blank page
Post Reply