Adding Ajax to a Simple Formmail PHP page


I am at the early stages of learning PHP and Ajax and would like detailed info on how I could update an existing Formmail form page to display a confirmation message on the same physical page without having to call a second 'ThankYou.html' type page.

When the user fills in the form and clicks submit, assuming the submission is successful, I would like to replace the actual form fields with a confirmation message. I'm assuming this requires Ajax.

Please provide details on how I can accomplish this.

Thank you!

Who is Participating?
Just place the form in an if statement :

if (!(isset($_POST['Submit1']))) 

// code to display form


// form processing code

// and thank you message


html page footer

Open in new window

That is an excellent example (just bookmarked it) however, with jaysch mentioning he is in the Early Stages I thought to show one of the many simple options...
greetings  jaysch, , , If you are new to AJAX, I would highly recomend learning some of the basics of AJAX php, and doing some of your own AJAX pages, before you use a prepared javascript package like jquery or prototype or mootools. So you will know some about how AJAX works and try to understand it not in a javascript framework.

You might look at some of the many many AJAX tutorials on the web, here are a couple that are very basic -

I do not recomend these, they are very simple, but they may get you to see what it is that ajax does, and the begining methods for it's use, most AJAX code is more complex than these show.
ask questions if you need more info.
jayschAuthor Commented:
This example as exactly what I was looking for. Works great for what I need.

Thank you everyone for your input.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.