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

Avatar of undefined
Last Comment
Ray Paseur

8/22/2022 - Mon
Ryan Chong

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
Raghav

ASKER
Thanks Ryan for your reply.

I will check this out.

Best Regards
Raghav.
Marcus Bointon

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.
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
Loganathan Natarajan

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.
Marcus Bointon

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
Ray Paseur

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Ryan Chong

Noted, thanks for highlighting Squinky...
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
Vimal DM

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
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.
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.
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
Ray Paseur

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"