webforms - How to redirect to another page in php after form is complete? -


i have registration form in site building. if filled correctly, want user go main page.

i tried use header "cannot modify header information..." guess happens because post $_server['php_self'];

any suggestions of how can redirect user if form ok? (other success page button)

you can use header() function if no other text/string data has been output web server users browser.

you'll need put logic redirect @ top of script before else:

<?php  // process form  // if processing successful, redirect if($success)  {     header("location: http://www.main-page-url.com/"); }  ?> 

the reason when browser receives information web server receives http header (which header() function outputs redirect to), , outputs body of http response after http header. if script echoing before header command, you'll continue receive error.


Comments

Popular posts from this blog

java - SNMP4J General Variable Binding Error -

windows - Python Service Installation - "Could not find PythonClass entry" -

Determine if a XmlNode is empty or null in C#? -