View Single Post
  #6 (permalink)  
Old Sep 15th, 2006, 17:48
ukgeoff ukgeoff is offline
Most Reputable Member
Join Date: Apr 2006
Location: Cornwall, UK
Posts: 1,310
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Open different pages depending on value entered into input box

Presumably there are only two page options, one for known customers and one for others?

Assuming customer numbers kept on a database and form using method='post'.

Your php code needs to do the following:

The code must start with; ob_start(); This buffers the header output until you have made up your mind what you want to do.

Code: Select all
$custnum = $_POST['custnum'];
... additional code
Code: Select all
$query = 'select id from customers where custnum ='.$custnum;
... more code
Code: Select all
if ($rows == 1){
   header('Location: http://domain.co.uk/customer.html');
}
else {
   header('Location: http://domain.co.uk/notcustomer.html');
}
... anything else you want to do

And finally:
Code: Select all
ob_end_flush();
Sends the header to the browser and the redirection takes place.
Reply With Quote