Hi
Im using jQuery to get the values from a form and pass to PHP for validation. Once validations are ok, how do I redirect to another page?
Using PHP header(location) doesnt seem to work.
Here my redirect code
header('Location: main.php');
How "doesn't seem to work"? Are you getting an error? Note that header() must be called before any output in php code. Drop the code in here.
HTTP/1.1 section 14.30, Header field definitions, specify that the locaion header should be
Location = "Location" ":" absoluteURI
And absoluteURI is defined in rfc 2396 section 3, URI Syntactic Components.
This issue has been fixed now
I just found out that the reason why header wont work is because it is in a page being requested by jQuery.
My solution was to pass a variable from the PHP to jQuery then use jQuery to redirect to another page.