|
Re: Problem in Redirect To Another Page -
03-27-2009, 11:49 AM
The problem is that the headers were sent just before <!DOCTYPE (not because it is a doctype, but because it is the first bit of HMTL). The headers would also be sent if you called echo or print. The headers can only be sent once, so when you try to redefine them using header() later in your script, it results in an error.
The solution is to either place the php code containing header() before any HTML, or use output buffering (ob_start(), ob_end_flush(), etc.) to control when the headers are sent. You could use variables as an alternative to the output buffering functions.
In your case, the echo statements that come before header() will cause the same error, so either use output buffering or modify your control statements (if, else, etc.) so that echo will never happen before header().
After closer examination of your code, I'm a little confused about what you are trying to do by using header() to redirect to salesenquiry.asp. Based on the logic, this redirect will always happen when the form is submitted, regardless of whether there is an error with image file. In addition, an error or a confirmation will always be displayed when the form is submitted. So what does salesenquiry.asp do?
|