PHP REDIRECT
Posted: Thu Aug 11, 2005 8:45 am
Here's what i'm trying to do:
SITUATION 1 - On submitting to my page - thePage.php from a form i'd like to:
1. insert some stuff into a database.
2. redirect to another page - aPage.html.
SITUATION 2 - On submitting to thePage.php from a link i'd like to:
1. insert some stuff into a database.
2. display some information and not redirect.
What I've done is passed from the form and from the link a variable to indicate which type of submission it is (note the form submits as get for other reasons). I'm able to insert into the database for both situations but for SITUATION 1 I am unable to redirect.
I've tried the following line:
header("Location: http://localhost/LisaMarie/aPage.html");
but the following error is thrown:
Warning: Cannot modify header information - headers already sent by (output started at C:\htdocs\LisaMarie\thePage.php:83) in C:\htdocs\LisaMarie\thePage.php on line 167
My questions:
1. Why is this error occuring, I don't have any other header setting code?
2. Is there any other way - within php - to perform redirecting.
3. Are there other easily used redirecting code that can be partnered with php to work effectively eg. JavaScript.
SITUATION 1 - On submitting to my page - thePage.php from a form i'd like to:
1. insert some stuff into a database.
2. redirect to another page - aPage.html.
SITUATION 2 - On submitting to thePage.php from a link i'd like to:
1. insert some stuff into a database.
2. display some information and not redirect.
What I've done is passed from the form and from the link a variable to indicate which type of submission it is (note the form submits as get for other reasons). I'm able to insert into the database for both situations but for SITUATION 1 I am unable to redirect.
I've tried the following line:
header("Location: http://localhost/LisaMarie/aPage.html");
but the following error is thrown:
Warning: Cannot modify header information - headers already sent by (output started at C:\htdocs\LisaMarie\thePage.php:83) in C:\htdocs\LisaMarie\thePage.php on line 167
My questions:
1. Why is this error occuring, I don't have any other header setting code?
2. Is there any other way - within php - to perform redirecting.
3. Are there other easily used redirecting code that can be partnered with php to work effectively eg. JavaScript.