Jump to content

Can I open a new page when the form processing completes?


SteveMann

Recommended Posts

I hope that this is a simple "DOH!" solution.

 

I have a page with a form on it, and the form action is to call my database insertion in a separate php file. This particular php file does not interact with the user it just adds the data to a mysql database.

 

Is there a method where I can send the user's browser to another page when the database update is complete - but without a button? I just want to start the PHP execution then go to a "thank-you" page.

 

Thanks

You can use the ob_start() function and the ob_flush() function:

http://php.net/manual/en/function.ob-start.php

http://www.php.net/manual/en/function.ob-flush.php

 

Then you will be able to send the code:

header('Location: thank_you.php')
exit();

 

 

 

Thanks, but I get the following error:

 

"Warning: Cannot modify header information - headers already sent by..."

 

I didn't think that I could put a header() after the php had already started.

 

Good idea, though..

 

 

Your processing script shouldn't generate any output, this way you can call header when its done.

Thanks, but I get the following error:

 

"Warning: Cannot modify header information - headers already sent by..."

 

I didn't think that I could put a header() after the php had already started.

 

Good idea, though..

 

 

Your processing script shouldn't generate any output, this way you can call header when its done.

 

 

AHA! - I have some debugging "echo" statements in the script.

 

I also found this way to do the same thing:

print "<meta http-equiv=\"refresh\" content=\"0;URL=finish.php\">";

 

 

Thanks to everyone for the help!!!!

Steve

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.