|
|
Stargeek's PHP ScriptsPlease select a category: |
Search Stargeek's PHP Scripts Database
|
PHP email form This is release 3 of my php email form script, used for creating a PHP contact form. It's a cleaner rewrite that organizes the code better for less expeirenced php users. Creates a php email form which allows a website viewer to send an email to the owner of the website from a form. This script is useful for php contact forms, like stargeek's PHP Contact Form.
Also check out the PHP Email tutorial, this will guide you through the usage of my script and installing the php contact form.
<?php //This is the location of your sendmail variable //if you don't know, contact your sysadmin $mail_path = "/usr/sbin/sendmail -i -t"; //The email address to be receiving emails from this form $mail_to = "zan@stargeek.com"; //the subject of the email sent by the form $mail_subject = "Contact Form";
//the name of the buisness or website that the form contacts $buisness_name = "Stargeek"; //this is the html of the form used to create the email $form_html = '$html = " <h1> To Contact $buisness_name: </h1> <form action=\"$PHP_SELF\" method=\"post\"> <table class=\"mainText\" border=\"0\" cellspacing=\"5\"> <tr> <td>Your Name: </td> <td>$name </td> </tr> <tr> <td>Your Email Address:</td> <td>$reply<td> </tr> <tr> <td colspan=\"2\" align=\"center\">Your Message</td> </tr> <tr> <td colspan=\"2\" align=\"center\">$message</td> </tr> <tr> <td colspan=\"2\" align=\"center\">$send</td> </tr> </table> </form> Script by <a href="http://www.stargeek.com">Stargeek</a> ";';
ini_set("sendmail_from", $mail_from); ini_set("sendmail_path", $mail_path); if ($_POST) { if($_POST['userEmail']) { if( mail($mail_to,$mail_subject,"\t From: ".$_POST['userName']."\n \t Email: ".$_POST['userEmail']. "\n\n\n\n".stripslashes($_POST['userMessage']).'this email was generated by <a href="http://www.stargeek.com">Stargeek</a>\'s script'.,"From: $_POST[userEmail]\r\n"."Reply-To: $_POST[userEmail]\r\n") ) { $html = 'Thank you for contacting '.$buisness_name.', '.$_POST['userName'].'. <br/>Your email was sent <br/>Script by <a href="htp://www.stargeek.com">Stargeek</a>'; } else { $html = 'There was an error'; } } } else { $message = '<textarea name="userMessage" rows="20" cols="70"></textarea>'; $name = '<input type="text" name="userName" size="30">'; $reply = '<input type="text" name="userEmail" size="30">'; $send = '<input type="submit" name="submit" value="Send">'; eval($form_html); } ?>
<html> <head> <title>-{Title Here}-</title> </head> <body> <?=$html?> </body> </html>
|
Most Popular Entries
|