Adding Ajax to a Simple Formmail PHP page

Hi,

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!

jayschAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

maeltarCommented:
Just place the form in an if statement :

<?php
if (!(isset($_POST['Submit1']))) 
{

// code to display form

 }else{

// form processing code

// and thank you message

}
?>

html page footer

Open in new window

0
mankowitzCommented:
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
maeltarCommented:
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...
0
Slick812Commented:
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 -

http://www.w3schools.com/PHP/php_ajax_database.asp
http://www.ajaxf1.com/tutorial/ajax-php.html?page=2

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.
0
jayschAuthor Commented:
This example as exactly what I was looking for. Works great for what I need.

Thank you everyone for your input.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.