kisan — 2011-12-17T00:46:37-05:00 — #1
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.
ralphm — 2011-12-17T01:05:07-05:00 — #2
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.
kisan — 2011-12-17T02:47:46-05:00 — #3
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.
ralphm — 2011-12-17T02:50:52-05:00 — #4
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?
kisan — 2011-12-17T02:56:49-05:00 — #5
It is not my need. Client wants it, as this form is on the landing page.
ralphm — 2011-12-17T03:03:00-05:00 — #6
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.
cups — 2011-12-17T12:02:13-05:00 — #7
This search results should give you a start : submit a form using jquery and refresh content in div.
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.
kisan — 2011-12-18T08:31:35-05:00 — #8
Thanks Cups, I will check it out.