Jump to content

How do make an email form?


keturahuriel

Recommended Posts

[sOLVED]How would I create an email form that doesn't use java or the mailto thing? Because mailto uses outlook. I'd like to send an order form straight to my email, but I don't know how to do that.Here's my order form:

<html><head><title>Order</title><style type="text/css">body {      background: #008080;      background-image: url (images/GaaraSpriteTiny.gif);      background-position: top left;      background-repeat: repeat-y;      font-family: Andale Mono, serif;      font size: 14pt;      font-color:#70DBDB;      margin: 20px;      }table {      border: thin dotted #32CD32;      padding: 15px;      }      th {      text-align: right;      vertical-align: top;      padding-right: 10px;      padding-top: 5px;      }      td {      vertical-align: top;      padding-bottom: 15px;      }      table table {      border: none;      padding: 0px;      }      table table td {      text-align: right;      padding-bottom: 0px;      }      p {      color: #000000;      border-style: dashed;      border-color: #00FF00;      text-indent: 2em;      font-family: sans-serif;      border-width: 2px;      margin: 5px;      }      #list {      height: 350px;      width: 600px;      overflow: auto;      }      #privpol {      color: #00FF00;      font-family: serif;      background: #000000;            }      #deliver {      background: #FFFFFF url (images/KPic.bmp) top left;      background repeat: none;      }            </style>      <body>      [color="#00FF00"]<form action="processorder.php" method="POST">[/color]            <table>        <tr>           <th>Choose your preferred artist:</th>           <td>             <br><select name="artist">                 <option value="keturah">Keturah</option>                 <option value="keaira">Keaira</option>                 <option value="rose">Rosetta</option>              </select>           </td>        </tr>                <tr>           <th>Coloring options:</th>           <td>              <input type="radio" name="color" value="bw" />              Black and White              <input type="radio" name="color" value="mono" />              Monochrome(if yes, please provide color in comments form.)              <input type="radio" name="color" value="full" />              Full color           </td>        </tr>                <tr>           <th>Name/Description/link of character(s)</th>           <td><textarea name="chardes" rows="10" cols="50"></textarea>           </td>        </tr>                <tr>           <th>Timezone and date</th>           <td><textarea name="datetime" rows="10" cols="50"></textarea>           </td>        </tr>                <tr>           <th>Comments</th>           <td><textarea name="comments" rows="10" cols="50"></textarea>              <br><br>              <input type="submit" value="Order Now">           </td>        </tr>      </table>      </form></body></html>

Link to comment
Share on other sites

<?phpif (isset($_REQUEST['email']))//if "email" is filled out, send email  {  //send email  $email = $_REQUEST['email'];   $subject = $_REQUEST['subject'];  $message = $_REQUEST['message'];  mail( "someone@example.com", "Subject: $subject",  $message, "From: $email" );  echo "Thank you for using our mail form";  }else//if "email" is not filled out, display the form  {  echo "<form method='post' action='mailform.php'>  Email: <input name='email' type='text' /><br />  Subject: <input name='subject' type='text' /><br />  Message:<br />  <textarea name='message' rows='15' cols='40'>  </textarea><br />  <input type='submit' />  </form>";  }?>

That's the one from w3schools, basic, but you can add more info fields if you want.http://w3schools.com/php/php_mail.asp-Matt

Link to comment
Share on other sites

That example is vulnerable to spam attacks though. You will want to validate the email address to make sure it is a single valid email address before sending the mail. If you do a search for PHP email validation you should find several examples using regular expressions.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...