Page 1 of 1

How to go to a URL

Posted: Sun May 25, 2003 3:10 pm
by Jerome
Hello all,

I'm very new to PHP. I have studied the manual but I can't find the function that I need. How do I make the browser go to a specific page (or URL)? To be more precise, I want to do the following. I have page1.php with a form, that goes to page2.php when the submit button is pressed. In page2.php the script adds a record to a MySQL database. I then want it to return to page1.php when it's finished. How do I do that?

Please tell me if you want me to supply the code.

Thanks in advance,

Jerome Smith

Posted: Sun May 25, 2003 3:21 pm
by m3mn0n
Yeah it's not too obvious, but it is quite simple...

Code: Select all

<?php
Header ("Location: url.php");
?>
It must be at the top and html headers will most likely cause errors if mixed with this.

Error Message

Posted: Sun May 25, 2003 3:39 pm
by Jerome
Hi Sami,

Thanks. Yes I tried that, and I got the following error message:

Warning: Cannot modify header information - headers already sent by (output started at /home/ftp/uploads/pruebas/FormIdiomaPrg23.php:4) in /home/ftp/uploads/pruebas/FormIdiomaPrg23.php on line 15

I would be really grateful if you can help me with this.

Jerome

Posted: Sun May 25, 2003 4:01 pm
by m3mn0n
Since the page you have the header() function on is only going to handle a query there is no need for any html headers or html code (if it's going to be an automatic forwarding).

Posted: Tue May 27, 2003 8:34 pm
by Jerome
OK Sami, thanks. I'll try that.