Forums

PHP

This topic is locked

redirecturl

Posted 11 Sep 2001 20:19:17
1
has voted
11 Sep 2001 20:19:17 Michael O'Neill posted:
I have a html page with a form, that when submitted sends the data to a php page for inclusion into a database. I would like the script to automatically redirect the user to another page. Can this be done in php.
Thanks
Mike.

Replies

Replied 12 Sep 2001 01:57:39
12 Sep 2001 01:57:39 Tim Green replied:
Indeed it can, and it's very easy. Insert the following after the code has been processed :-

<?php
header("Location: mypage.php";
?>

Where mypage.php is the destination address. Very important though is to make sure that before you use a header() command is that no output has been previously sent to the browser, so make sure that no HTML is sent, that there are no blank lines in your code between PHP Code Blocks and that nothing has been echoed in your PHP Script, or it will just generate an error.

Hope this helps

Tim Green

Extension & PHP TalkZone Manager
<font size=1>-------------------------------------------
<i>Please read the Forum FAQ before posting
a question to this TalkZone.</i>
-------------------------------------------
www.UDzone.com : A dynamic Dreamweaver,
Ultradev and Fireworks site for developers
by developers.
-------------------------------------------</font id=size1>
Replied 12 Sep 2001 10:00:44
12 Sep 2001 10:00:44 Michael O'Neill replied:
I tried this already but I was sending output to the browser before the header "DUH".
Many Thanks
Mike.

Replied 12 Sep 2001 10:33:41
12 Sep 2001 10:33:41 Tim Green replied:
It's a mistake easily made Mike. Glad I could be of help.

Tim Green

Extension & PHP TalkZone Manager
<font size=1>-------------------------------------------
<i>Please read the Forum FAQ before posting
a question to this TalkZone.</i>
-------------------------------------------
www.UDzone.com : A dynamic Dreamweaver,
Ultradev and Fireworks site for developers
by developers.
-------------------------------------------</font id=size1>

Reply to this topic