HTML Form and thank you on the same location of the page

On a Web page, I have a form requesting for a demo.
When one submits the form, I need to displays Thanks in the same location of the webpage without refreshing and send a e-mail to me.
I hope I have made myself clear.

Thanks in advance.

With PHP, you can have the Thankyou message appear in place of the form (on the same page), but as far as I know, the page still needs to refresh for this to happen.

The page is a HTML page and not php. There are several other elements on the page, among them is this HTML form with just two fields Name and E-mail. When on submits it, I need to say thanks at the same location of the form without refreshing the page.

I know the PHP method.

You would have to use JS then, but it is less reliable (as users may have it disabled). I am always wary when people say they “need” something. Is it really a need?

It is not my need. Client wants it, as this form is on the landing page.

Yes, that’s usually the case. I get frustrated by clients who want things that aren’t practical, or that are purely to satisfy their vanity at the expense of usability. Anyway, sorry for the rant! Having other elements on the page is not a problem as far as PHP goes. Anyhow, a combination of JS/Ajax and PHP might be the best solution, but I’m not qualified to advise on that. Hopefully someone else will step in now. :slight_smile:

This search results should give you a start : [google]submit a form using jquery and refresh content in div[/google].

Get this working using the simplest html page possible to prove to yourself the concept works, then add back into a PHP page.

If you do end up having PHP output JS then you are going to have to be very careful with your single/double quotes and you should look at using the HEREDOC syntax for that.

Thanks Cups, I will check it out.