Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2006-06-01 00:54:23
- neilbag00
- New Member
- Registered: 2006-03-11
- Posts: 9
php form submission redirect not working
I am using a php include to handle a basic html feedback form which automatically redirects on submission.
I am placing: <?php require(“includes/form_processor.inc.php”); ?> at the very beginning of the page in Textpattern and the form works ok, sends an email etc BUT the redirect doesn’t work.
That is, the php line: header(“Location: thankyou”); just goes to a page with “200 OK: OK The document has moved here.” (‘here’ is a link with the desired url).
Everything works perfectly in a non-textpattern setup so I know the php file is sound.
Is this something to do with headers already being sent? How do I fix this, any ideas?
Many many Thanks!!
Neil
Offline
#2 2006-06-01 01:27:16
- zem
- Developer Emeritus
- From: Melbourne, Australia
- Registered: 2004-04-08
- Posts: 2,579
Re: php form submission redirect not working
It’s probably a bug (or at least a poorly documented oversight) in PHP.
Do it the way Textpattern does. grep Location for details.
Alex
Offline
#3 2006-06-01 05:31:11
- net-carver
- Archived Plugin Author
- Registered: 2006-03-08
- Posts: 1,648
Re: php form submission redirect not working
This works for me—it’s used in a plugin but does the job.
<pre><code>if( $redirect ) {
if( ‘self’ == $redirect )
$redirect = serverSet(‘REQUEST_URI’);
header(‘HTTP/1.1 303 See Other’);
header(‘Status: 303’);
header(‘Location: ‘.$redirect);
header(‘Connection: close’);
}
else{ …
</code></pre>
Last edited by net-carver (2006-06-01 05:32:18)
— Steve
Offline