Link to home
Start Free TrialLog in
Avatar of Raghav
RaghavFlag for India

asked on

PHP form in html website

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.
Avatar of Ryan Chong
Ryan Chong
Flag of Singapore image

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
Avatar of Raghav

ASKER

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.
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.
ASKER CERTIFIED SOLUTION
Avatar of Ray Paseur
Ray Paseur
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Noted, thanks for highlighting Squinky...
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
Avatar of Raghav

ASKER

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.
Avatar of Raghav

ASKER

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.
There are several learning resources identified in this article:
https://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"