You are here: header() with if/then statements « PHP Programming Language « IT news, forums, messages
header() with if/then statements

Posted by Jerim79 on 11/17/06 17:08

I have created a verification script to verify information and redirect
the customer to the appropriate error page. For example:

if ($FName=""){
header('Location:/verify_fname.htm');
}
else{
if ($LName=""){
header('Location:/verify_lname.htm');
}
else{
if ($Company=""){
header('Location:/verify_company.htm');
}
else{
if ($Title=""){
header('Location:/verify_title.htm');
}
}
}
}

The intent of the code is to check a variable. If an error is found in
the variable, it redirects to the correct error page. Otherwise, it
continues on through the else statement which then checks another
variable and so and so on. The final else statement redirects to a
process script that takes all the information writes it to a table. I
am getting this error message:
Cannot modify header information - headers already sent by

I can't put the redirect before the HTML as I want the redirect to be
conditional. Any help would be appreciated.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация