phpjqueryjquery-address

JQuery Address and PHP_SELF in contact form


I'm rebuilding a website to use Jquery Address to load in a page's content in a within the main page. This works fine apart from the contact page - contact.php. This contains a form which posts to the same page, where the data is validated and any error messages shown, or if there are no errors the email is sent.

<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>" id="contactform" name="contactform">
...
</form>

This worked before the ajax navigation was implemented, but now it directs the browser to contact.php, rather than to the holding index.php with contact.php within it.

Are there any best practice-type guidelines for contact forms with ajax navigation? Any help much appreciated.

HR


Solution

  • Well...either you change the action in the form to call a page that will properly set the AJAX navigation back up after handling the form or you modify the form and have it send the data via AJAX to the server without reloading the page. I guess the latter would be the better solution because then everything would behave consistenly like an AJAX application.

    Of course you will have to modify the script that handles the contact form in either way.