I’m using jquery mobile and jquery.validate to validate a form.
I also have PHP validation that checks the fields if JS is disabled using sessions
The form posts to itself ($_SERVER['PHP_SELF'])
What I’m looking to do, is once the form passes validation, redirect to a success page
The validation works fine using js and php, so thats not my problem
I have the $_POST stored in a session variable and I’m using header("Location: success.php") to redirect to the success page.
When JS is disabled, this works fine and I can access the POST data that is in the session (checked using var_dump()) in success.php, the problem is, when JS is enabled, when redirecting to success.php, nothing seems to be sent.
I get the following in the HTML:
<div data-role="page" data-url="/apply.php" data-external-page="true" tabindex="0" class="ui-page ui-body-c ui-page-active" style="min-height: 394px; ">undefined</div>
Does anyone have any ideas why the redirect doesn’t seem to be working?
Thanks
My php file is as follows
- php check that form has been sent
- store all post variables
- set session variables to post variables and store these in the form input
value=""fields - do validation
- if passes validation, redirect with header()
- display html form
Ok. So having looked around, it seems that jQuery mobile was the issue. Adding data-ajax=”false” to my seems to have fixed the redirect issue