How to create a form in a web page with HTML

I want to create a web page in which a form allows the user to insert some personal informations (name surname, phone, etc.) and send them to me in my email box (see http://www.maestripieri.it/mod/contatto).
How is it possible with HTML?
LVL 9
Sar1973Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

quincydudeCommented:
The easiest way is set the action of the form as your email address like
<form method="post" 
   action="mailto:yourname@yoursite.com" 
     enctype="text/plain">
<input type=text 
   name=your_comments>
<input type=submit 
   value="Submit Your Comments">
</form>

Open in new window

0
Andrew DoadesIT TechnicianCommented:
The above will open a new email windows for the user, I have attached some code for a form.html file and a php mailer script, although they look messy they work!

Hope they work for you!
#HTML FILE...
 
<form method="POST" action="mailer.php">
 
          <table border="0" ALIGN="CENTER" cellpadding="5" cellspacing="0" align="center" style="font-family: Tahoma; font-size: 9pt;">
          <tr>
          <td align="left">Your Name:</td>
          <td align="left" valign="middle"><input type="text" name="name" size="35" style='width: 300px;'>
          </td>
          </tr>
          <tr>
          <td  align="left">Your
          Email Address:</font></td>
          <td  align="left" valign="middle"> <input type="text" name="email" size="35" style='width: 300px;'>
          </td>
          </tr>
          <tr>
          <td  align="left">Subject:</font></td>
          <td  align="left" valign="middle"> <input type="text" name="message_subject" size="35" style='width: 300px;'>
          </td>
          </tr>
          <tr>
          <td  align="left" valign="top">Your
          Message:</font></td>
          <td  align="left" valign="top"><textarea name="message" cols="30" rows="8" wrap="VIRTUAL" style='width: 300px;'></textarea>
          </td>
          </tr>
          <tr>
          <td colspan=2 align=center valign=middle><input type="submit" value="Submit" name="submit">
          </td>
          </tr>
          </table>
          </form>
 
#PHP  MAILER SCRIPT
 
<?php
if(isset($_POST['submit'])) {
 
$to = "to@domain.com";
$subject = "Contact from website";
$from = "from@domain.com";
$name_field = $_POST['name'];
$email_field = $_POST['email'];
$message = $_POST['message'];
$message_subject = $_POST['message_subject'];
 
$body = " From: $name_field\n E-Mail: $email_field\n Subject: $message_subject\n Message: $message";
 
echo "Data has been submitted successfully.";
mail($to, $subject, $body);
 
} else {
 
echo "Sending failed, please check all fields";
 
}
?>

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Sar1973Author Commented:
-
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
HTML

From novice to tech pro — start learning today.