I have a page built of php includes. One of which is a submit form along with a script that posts to itself.
The problem is that since the content is in an include and the parent page already has header info, I can't use the header function to redirect after the form has been processed. One solution of which I can think is to simply remove the script to a separate file. This seems rather inelegant compared to having everything in one document.
Thoughts? Thanks.
Header Function Question
Moderator: General Moderators
- AbraCadaver
- DevNet Master
- Posts: 2572
- Joined: Mon Feb 24, 2003 10:12 am
- Location: The Republic of Texas
- Contact:
Re: Header Function Question
As long as the processing script doesn't output anything then you can use header(). Don't include the form if you don't need it:
Code: Select all
if(!isset($_POST['submit'])) {
//include form
} else {
//include form processing script
}mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
Re: Header Function Question
Thanks man. What a big help!
I was echoing a line of text as well. Once that was out it worked fine.
I was echoing a line of text as well. Once that was out it worked fine.