Jump to content
xisto Community
Sign in to follow this  
iGuest

Form Mail Scipt (PHP)

Recommended Posts

This script is my first for php. It not only sends the information you want to you, but also e-mails the person a reply in html saying you recieved there data.

This is the error script at the top of the template_reques_form.php page. THis checks if all feilds are filled out

<?function errOr() {	if($_GET['error']) {  	echo "<font color="red" size="3">Please make sure all required fields have been completed!</font>";	}}function comPlete() {	if($_GET['complete']) {  	echo "<font color="red" size="3">Thank you!  Your request has been completed.<br>Your template will be added to the list and completed ASAP!!</font>";	}}?>

this is the form with the php code before it to check for errors
<?errOr();comPlete();?><form action="template_submit.php" method="post">  <table width="410" border="1" bordercolor="#666666">    <tr>       <td width="149"><div align="right">*Name:</div></td>      <td colspan="2"><input name="name" type="text" id="name" size="42" class="inputs"></td>    </tr>    <tr>       <td><div align="right">*E-Mail:</div></td>      <td colspan="2"><input name="email" type="text" id="email" size="42" class="inputs"></td>    </tr>    <tr>       <td><div align="right">*Forums Name:</div></td>      <td colspan="2"><input name="forumname" type="text" id="forumname" size="42" class="inputs"></td>    </tr>    <tr>       <td colspan="3"> </td>    </tr>    <tr>       <td rowspan="2" valign="top"><div align="right">*Template Colors:</div></td>      <td width="116"><div align="left">#           <input name="color1" type="text" id="color1" size="10" maxlength="6" class="inputs">        </div></td>      <td width="131"><div align="left">#           <input name="color2" type="text" id="color2" size="10" maxlength="6" class="inputs">        </div></td>    </tr>    <tr>       <td><div align="left">#           <input name="color3" type="text" id="color3" size="10" maxlength="6" class="inputs">        </div></td>      <td><div align="left">#           <input name="color4" type="text" id="color4" size="10" maxlength="6" class="inputs">        </div></td>    </tr>    <tr>       <td><div align="right">*Template Theme:</div></td>      <td colspan="2"><select name="theme" id="theme" class="inputs">          <option value="art_lit">Art & Literature</option>          <option value="auto">Automobiles</option>          <option value="comp_internet">Computers & Internet</option>          <option value="education">Education</option>          <option value="entertainment">Entertainment</option>          <option value="family_parents">Family & Parents</option>          <option value="game_clans">Gaming: Clans</option>          <option value="games_console">Gaming: Console</option>          <option value="games_general">Gaming: General</option>          <option value="games_rpg">Gaming: RPG</option>          <option value="games_specific">Gaming: Specific Game</option>          <option value="graphich_design">Graphics & Design</option>          <option value="health_medicne">Health & Medical</option>          <option value="hobbies">Hobbies</option>          <option value="misclienaneous">Miscellaneous</option>          <option value="music">Music</option>          <option value="news_politcs">News & Politics</option>          <option value="online_communities">Online Communities</option>          <option value="outdorr_nature">Outdoors & Nature</option>          <option value="programming">Programming</option>          <option value="religous">Religious</option>          <option value="sports">Sports</option>          <option value="teens">Teens</option>          <option value="tv_movies">TV & Movies</option>          <option value="windows">Windows</option>        </select></td>    </tr>    <tr>       <td><div align="right">*Template Demensions:</div></td>      <td colspan="2">height         <input name="height" type="text" id="height" size="5" class="inputs">        x         <input name="width" type="text" id="width" size="5" class="inputs">        width</td>    </tr>    <tr>       <td colspan="3"><div align="right"></div></td>    </tr>    <tr>       <td><div align="right">Expandable::</div></td>      <td colspan="2">Yes <input type="radio" name="expandable" value="yes" class="inputs">        No         <input type="radio" name="expandable" value="no" class="inputs"></td>    </tr>    <tr>       <td><div align="right">iframes:</div></td>      <td colspan="2">Yes         <input type="radio" name="iframes" value="yes" class="inputs">        No         <input type="radio" name="iframes" value="no" class="inputs"></td>    </tr>    <tr>       <td><div align="right">Design Basis:</div></td>      <td colspan="2"><input name="design" type="text" id="design" size="42" class="inputs"></td>    </tr>    <tr>       <td colspan="3"> </td>    </tr>    <tr>       <td valign="top"><div align="right">Specific Insturctions:</div></td>      <td colspan="2"><textarea name="instructions" cols="32" rows="15" id="instructions" class="inputs"></textarea></td>    </tr>    <tr>       <td height="21" colspan="3"><div align="center">           <input type="submit" name="Submit" value="Submit Template Request">          <input name="reset" type="reset" id="reset" value="Reset The Template Form">        </div></td>    </tr>  </table></form>

here is the php script file template_submit.php this is where all the magic happens
<? ob_start();$name = $_POST['name'];$email = $_POST['email'];$forumname = $_POST['forumname'];$color1 = $_POST['color1'];$color2 = $_POST['color2'];$color2 = $_POST['color2'];$color3 = $_POST['color3'];$color4 = $_POST['color4'];$theme = $_POST['theme'];$height = $_POST['height'];$width = $_POST['width'];$expandable = $_POST['expandable'];$iframes = $_POST['iframes'];$design = $_POST['design'];$instructions = $_POST['instructions'];$subject = $fourmname . " Templaete Request:rn";if((!$name) || (!$email) || (!$forumname) || (!$color1) || (!$color2) || (!$color3) || (!$color4) || (!$theme) || (!$height) || (!$width) || (!$instructions)) {	header("Location: template_request_form.php?error=1");}$message = "Template Request By: " . $forumname . "rn";$message .= "-------------------------------rn";$message .= "Name: " . $name . "rn";$message .= "E-mail: " . $email . "rn";$message .= "Forum Name: " .$forumname . "rn";$message .= "-------------------------------rn";$message .= "Template Color #1: #" . $color1 . "rn";$message .= "Template Color #2: #" . $color2 . "rn";$message .= "Template Color #3: #" . $color3 . "rn";$message .= "Template Color #4: #" . $color4 . "rn";$message .= "Template Theme: " . $theme . "rn";$message .= "Template Demensions: " . $height . "x" . $width . "rn";if($expandable)	$message .= "Expandable: " . $expandable . "rn";	if($iframes)	$message .= "iframes: " . $iframes . "rn";if($design)	$message .= "Design Basis: " . $design . "rn";	$message .= "Other Indtructions: " . $instructions . "rn";$to = $admin;     $subject = "Template Request By: " . $forumname . "rn"; $headers = "From: " . $email . "rn" . "Bcc: " . $bcc . "rn"; mail($to, $subject, stripslashes($message), $headers); ?> <?php  function reply() {   $rep = <<<EOD <p><font color="#B60000" size="5" face="Arial, Helvetica, sans-serif"><strong>.:   Template Request Completed :.</strong></font></p><p><font color="#B60000" size="2" face="Arial, Helvetica, sans-serif">Thank you   for the template request. Your request will be added to the list i have stored   on my computer. Your template can be moved up on this list by donating $5 to   the Stoned Devil Industries paypal account. After you have put this money in   the account, and e-mail will be sent to you containing information that i received   the transaction. Afterwards your template will be moved up on the list to the   top, and will be done ASAP. Remeber i have other people paying, and also paying   family/friends comes before people i dont know.</font></p><hr><p><font color="#B60000" size="2" face="Arial, Helvetica, sans-serif">Rember this,   as said in the request forms, you must be a member of the Stoned Devil Industries   forums, and have a post count of at least 5, or any request you send will be   deleted. EVEN FOR PAYING CUSTOMERS (money will be refunded)!! I do not yet have   a support ticket system, so i have to use the forums as a support section, so   make sure you are a member. If you are not when you sign up, you have one day   before i will delete your request, to sign up on my forums. </font></p><hr><font color="#B60000" size="2" face="Arial, Helvetica, sans-serif"><br>Sincerly,<br>Corey D. Eacret<br>STD Inc. Managment Tea<br><br></font> <hr><div align="left"><font color="#B60000" size="2" face="Arial, Helvetica, sans-serif"><br>  You are receiving this e-mail becuase you submited a request form on http://forums.xisto.com/no_longer_exists/.'>http://forums.xisto.com/no_longer_exists/.   THIS IS NOT SPAM. If you did not request this, send an e-mail to orionleingod@gmail.com   with subject "CANCEL REQUEST" and nothing in the body. If you would   not like to receive anymore updates about this request, send an e-mail to orionleingod@gmail.com   with the subject "UNSUBSCRIBE REQUEST".<br>  </font><font color="#B60000" size="3" face="Arial, Helvetica, sans-serif"><br>  </font>   <hr>  <div align="center"><font color="#B60000" size="3" face="Arial, Helvetica, sans-serif"><br>    </font><font color="#B60000" size="2" face="Arial, Helvetica, sans-serif"><font size="1">Copyright©     2005 Stoned Devil Industries<br>    Web Design Division<br>    http://forums.xisto.com/no_longer_exists/ color="#B60000" size="3" face="Arial, Helvetica, sans-serif">     </font></div></div>EOD;  return $rep;  }  $replymessage = reply(); $replyto = $email;     $replysubject = "Template Request Received.rn"; $headers  = 'MIME-Version: 1.0' . "rn";$headers .= 'Content-type: text/html; charset=iso-8859-1' . "rn";$headers .= "From: " . $admin . "rn" . "Bcc: " . $bcc . "rn"; mail($replyto, $replysubject, $replymessage, $headers); header("Location: template_request_form.php?complete=1"); ob_end_flush();?> 

there you go

see this code in action at http://forums.xisto.com/no_longer_exists/?i=template_request_from.php

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.