PHP form in html website

Raghav
Raghav used Ask the Experts™
on
Hello Experts,

I have a html website and i want to add a web form which can record the Name, E-Mail and Phone number and send validation mail to the person who filled the form. When a person validates e-mail address, should get an auto reply with an attachment.

Can i achieve this in pure HTML site? Do i need to use PHP or are there any alternatives to do this? I have tried online web form builders but they do not fulfill my requirements besides they are costly.

A step by step guide would be very much helpful and would be greatly appreciated. Thanks.

Best Regards
Raghav.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Ryan ChongSoftware Team Lead

Commented:
a web form could be as simple as a HTML file, but seems you going to capture data and send validation emails, your web form need to be posted to a server side scripting page (like .php page), so that the data submitted could be saved into a database, etc and do the relevant actions (like sending validation email) accordingly.

you can check these articles out on how to send out emails in PHP:

Using phpMailer to Send Mail through PHP
http://www.inmotionhosting.com/support/email/send-email-from-a-page/using-phpmailer-to-send-mail-through-php

Sending attachments with email
http://www.tutorialspoint.com/php/php_sending_emails.htm
RaghavIT Specialist

Author

Commented:
Thanks Ryan for your reply.

I will check this out.

Best Regards
Raghav.
Please don't use the script from InMotion. They have based their code on an obsolete example and are using a very old, buggy version of PHPMailer. I've no idea why they chose to host their own copy instead of linking directly to the source. The tutorialspoint example is also very buggy, and a good example why you should not call `mail()` yourself. Get the latest PHPMailer, and you'll find it comes with up-to-date examples.
Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Here is a  correct  example for phpMailer library.

When you use this library it helps to send html based and avoid spam at the maximum.
No, that's also an ancient, long out of date example. If you want a tutorial, there is an up to date tutorial on Github.
Most Valuable Expert 2011
Top Expert 2016
Commented:
The general design pattern you want is shown in this article.
http://www.experts-exchange.com/articles/3939/Registration-and-Email-Confirmation-in-PHP.html

Please read it over and post back if you still have questions.  If you' re new to PHP, this article might be helpful, too.
http://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html
Ryan ChongSoftware Team Lead

Commented:
Noted, thanks for highlighting Squinky...
Vimal DMSenior Software Engineer

Commented:
HI,

1.Create HTML form controls in a html file
2.Add FORM ACTION to "processform.php" and type to POST
3.In the processform.php get those posted values and store it in Database
RaghavIT Specialist

Author

Commented:
Hello Experts,

Sorry for the delay in response.

I was traveling and did not get any chance to look at the solutions.

I will read them out and post the results. Thanks a lot.

Best Regards
Raghav.
RaghavIT Specialist

Author

Commented:
Hi Ray,

Your articles helped me a lot in understanding the concept.

I managed to create a form with simple submission. I will now try to implement verification in to this.

Thanks a lot.  

BTW you had suggested some reading material to someone in your article. May i also get some suggestions?  I am not a pro in PHP but manage to write simple code with learn and try method.

Best Regards
Raghavendra.
Most Valuable Expert 2011
Top Expert 2016

Commented:
There are several learning resources identified in this article:
http://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html

If you like books (I do) check the paragraph about "Learning PHP from Books"

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial