Current location: Hot Scripts Forums » Programming Languages » PHP » Help, Simple order form.


Help, Simple order form.

Reply
  #1 (permalink)  
Old 03-25-11, 04:26 AM
Ledz Ledz is offline
New Member
 
Join Date: Mar 2011
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Question Help, Simple order form.

Hello everyone im working on a simple order form and now i have made the HTML form but i cant figure it out to send me the email.
Can someone help me to provide me the required code so i will recieve the orders
Here is the Html form:
HTML Code:
<div id="container">
  <table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="95%" align="left" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="2%">&nbsp;</td>
        <td width="98%" align="left" valign="top"><table width="808" border="0" cellpadding="0" cellspacing="0">
          <tr>
          	<td height="592" colspan="6">&nbsp;</td>
          </tr>
          <tr>
          	<td colspan="6">* Required</td>
          </tr>
          <tr>
            <td>Name</td>
            <td width="146">* Lastname</td>
            <td width="215">* Street name</td>
            <td width="83">* House nr</td>
            <td width="93">Letter</td>
            <td width="123">Floor</td>
          </tr>
          <tr>
            <td><input type="text" name="firstname" id="firstname" class="felt" value=""></td>
            <td><input type="text" name="lastname" id="lastname" class="felt" value=""></td>
            <td><div id="stretcontainer"><input type="text" name="street" id="street" class="felt" value=""></div></td>
            <td><input type="text" name="streetNum" id="streetNum" class="felt2" value="" maxlength="6"></td>
            <td><input type="text" name="streetLetter" id="streetLetter" class="felt2" value="" maxlength="3"></td>
            <td><input type="text" name="streetfloor" id="streetfloor" class="felt2" value="" maxlength="6"></td>
                     </tr>
          <tr>
            <td width="148">Side</td>
            <td>Apart. nr.</td>
            <td>* Tel</td>
            <td align="left" colspan="3">* E-mail</td>
          </tr>
          <tr>
          	<td><select name="streetSide" id="streetSide" class="felt3">
              <option value="">&nbsp;</option>
              <option value="left.">tv.</option>
              <option value="middle.">mf.</option>
              <option value="right.">th.</option>
            </select></td>
            <td><input type="text" name="streetApartment" id="streetApartment" class="felt2" value="" maxlength="6"></td>
            <td><input type="text" name="phone" id="phone" class="felt" value="" maxlength="8"></td>
            <td align="left" colspan="2"><input type="text" name="email" id="email" class="felt" value=""></td>
            <td rowspan="2">
            <input type="image" src="images/knap.jpg" name="submit"/>
<!--            <input type="submit" value="Send"/> -->
            </td>
          </tr>
          <tr>
            <td align="left" colspan="5"><input type="checkbox" name="accept" value="yes"/>
            Yes! i have read and acceptet <a href="#inline1" id="various1">conditions</a>
            </td>
          </tr>
        </table></td>
      </tr>
    </table></td>
  </tr>
  </table>
</div>
Reply With Quote
  #2 (permalink)  
Old 03-26-11, 02:00 AM
dgreenhouse's Avatar
dgreenhouse dgreenhouse is offline
Aspiring Coder
 
Join Date: Mar 2009
Location: San Francisco
Posts: 457
Thanks: 0
Thanked 3 Times in 3 Posts
Since you're the only one getting the email, something like the following should suffice.
If you want to make it an HTML mail, look at some of the comments under the mail command in the PHP manual.

The following code assumes that mail is enabled on the server.
If it's not, you can use cURL to connect to a SMTP server with PHP.
Code:
$to = 'sombody@example.com';
$subject = 'the subject';
$message = 'Values from order go here...';

mail($to, $subject, $message, $headers);
Reply With Quote
  #3 (permalink)  
Old 03-26-11, 02:52 AM
job0107's Avatar
job0107 job0107 is offline
Community Liaison
 
Join Date: Dec 2006
Location: Tacoma, Washington USA
Posts: 3,454
Thanks: 0
Thanked 140 Times in 137 Posts
This is probably as simple as it gets.
Enter your email address in the $to variable.
There is no validation for the required fields, so you will have to add that.
You can do it with either JavaScript or PHP.
PHP Code:

<?php
if(!empty($_POST))
{
 
$to "";  // Enter your email address here. //
 
$subject "Order Form";
 
$message "";
 foreach(
$_POST AS $key => $value)
 {
  if(
$key != "submit_x" && $key != "submit_y"){$message .= $key." = ".$value."<br />";}
  }
 
$headers  'MIME-Version: 1.0' "\r\n";
 
$headers .= 'Content-type: text/html; charset=iso-8859-1' "\r\n";
 if(
mail($to$subject$message$headers)){echo "Thank you for your order.";}
 }
else{
?>
<html>
<head>
</head>
<body>
<div id="container">
<form action="#" method="post">
 <table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
   <td width="95%" align="left" valign="top">
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
     <tr>
      <td width="2%">&nbsp;</td>
      <td width="98%" align="left" valign="top">
       <table width="808" border="0" cellpadding="0" cellspacing="0">
        <tr>
            <td height="592" colspan="6">&nbsp;</td>
        </tr>
        <tr>
            <td colspan="6">* Required</td>
        </tr>
        <tr>
         <td>Name</td>
         <td width="146">* Lastname</td>
         <td width="215">* Street name</td>
         <td width="83">* House nr</td>
         <td width="93">Letter</td>
         <td width="123">Floor</td>
        </tr>
        <tr>
         <td><input type="text" name="firstname" id="firstname" class="felt" value=""></td>
         <td><input type="text" name="lastname" id="lastname" class="felt" value=""></td>
         <td><div id="stretcontainer"><input type="text" name="street" id="street" class="felt" value=""></div></td>
         <td><input type="text" name="streetNum" id="streetNum" class="felt2" value="" maxlength="6"></td>
         <td><input type="text" name="streetLetter" id="streetLetter" class="felt2" value="" maxlength="3"></td>
         <td><input type="text" name="streetfloor" id="streetfloor" class="felt2" value="" maxlength="6"></td>
        </tr>
        <tr>
         <td width="148">Side</td>
         <td>Apart. nr.</td>
         <td>* Tel</td>
         <td align="left" colspan="3">* E-mail</td>
        </tr>
        <tr>
            <td>
          <select name="streetSide" id="streetSide" class="felt3">
           <option value="">&nbsp;</option>
           <option value="left.">tv.</option>
           <option value="middle.">mf.</option>
           <option value="right.">th.</option>
          </select>
         </td>
         <td><input type="text" name="streetApartment" id="streetApartment" class="felt2" value="" maxlength="6"></td>
         <td><input type="text" name="phone" id="phone" class="felt" value="" maxlength="8"></td>
         <td align="left" colspan="2"><input type="text" name="email" id="email" class="felt" value=""></td>
         <td rowspan="2">
          <input type="image" src="images/knap.jpg" name="submit"/>
          <!-- <input type="submit" value="Send"/> -->
         </td>
        </tr>
        <tr>
         <td align="left" colspan="6">
          <input type="checkbox" name="accept" value="yes"/>
          Yes! i have read and acceptet <a href="#inline1" id="various1">conditions</a>
         </td>
        </tr>
       </table>
      </td>
     </tr>
    </table>
   </td>
  </tr>
 </table>
</form>
</div>
</body>
</html>
<?php ?>
__________________
Jerry Broughton
Reply With Quote
  #4 (permalink)  
Old 03-26-11, 03:06 AM
Ledz Ledz is offline
New Member
 
Join Date: Mar 2011
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
thanks for your help guys, i will try it asap.
Reply With Quote
Reply

Bookmarks

Tags
contact, form, mail, order


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Simple addition on a web form JonChuck JavaScript 13 03-15-10 07:31 AM
[SOLVED] Simple form validation question macintosh PHP 1 03-29-09 01:31 AM
Simple Order Status Retrieval Script Josiah Script Requests 0 01-07-09 11:22 PM
simple php registration form manuleka Script Requests 1 07-19-07 09:08 PM
WANTED Simple Form Processor help OnlyPhp.Com PHP 10 09-13-04 07:49 PM


All times are GMT -5. The time now is 08:47 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.