Problems with redirecting code

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

Post Reply
johnj
php-forum Super User
php-forum Super User
Posts: 1805
Joined: Thu Mar 10, 2011 5:07 pm

Re: Problems with redirecting code

Post by johnj » Tue May 14, 2013 5:48 am

please read about header() function in php.

User avatar
daveismyname
New php-forum User
New php-forum User
Posts: 26
Joined: Sat Oct 15, 2011 3:21 am
Location: Hull, East Yorkshire, England
Contact:

Re: Problems with redirecting code

Post by daveismyname » Wed May 15, 2013 10:52 pm

try it like this:

Code: Select all

<?php
$salesrep = $_POST['salesrep'];
if ($salesrep == 'Dan') {
	//redirect
	header('Location: http://www.reps_url.com');
	exit;
}
elseif ($salesrep == 'Sally') {
	//redirect
	header('Location: http://www.reps_url.com');
	exit;
}
else ($salesrep != '') {
$name = "<h1>Code not on file</h1> 
<p>UPPERCASE and lowercase matters make sure it was just as you saw it<br />
use your browsers back to try again</p>";
}
?>

Post Reply

Who is online

Users browsing this forum: klyxmaster and 7 guests