Mega Code Archive

 
Categories / Php / Code Snippets
 

This is a simple email form example

Part 1 is the code for the form itself. <table width="538"> <tr> <td ALIGN=LEFT> <form ACTION="email.php" METHOD="POST"> Name:<br> <input TYPE="text" NAME="name" SIZE="20" MAXLENGTH="30"> <br> Email address you are sending to: <br> <input TYPE="text" NAME="email" SIZE="20" MAXLENGTH="30"> <p>Your Email: <br> <input TYPE="text" MAXLENGTH="40" WIDTH="20" NAME="yourmail"> <br> Subject:<br> <input TYPE="text" NAME="subject" SIZE="20" MAXLENGTH="30"> <br>Message: <br> <textarea ROWS="11" COLS="40" NAME="message"></textarea> <p> <input TYPE="submit" VALUE="Send mail"> <br> </form> </tr> </table> Part 2 is the actual php script in this case email.php <?php echo "Hello, $name."; echo "<BR><BR>"; echo "You have successfully sent your mail"; echo "<BR><BR>"; mail("$email", "$subject"," $message. My E-mail is $youremail. Greetings from $name."); ?>