FRIHOSTFORUMSSEARCHFAQTOSBLOGSDIRECTORY
You are invited to Log in or Register a Frihost Account!

A Simple Form Mail in PHP

 


Veckn
Below are a code to create a simple form mail in a site like a "contact us" form:

It is needed 2 archives:
contact.php (can be ".htm" or "html")
sendmail.php

The contact.php
Code:
<html>
<head>
<title>Site Title</title>
</head>
<body>
<form action="sendmail.php" method="post" name="contact" id="contact">
<table width="768"  border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="right">Name:</td>
<td><input name="name" type="text" id="name" size="30" maxlength="50"></td>
</tr>
<tr>
<td align="right">E-mail:</td>
<td>
<input name="email" type="text" id="email" size="30" maxlength="50"></td>
</tr>
<tr>
<td align="right" valign="top">Message:</td>
<td><textarea name="message" cols="40" rows="5" id="message"></textarea></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>
<input name="submit" type="submit" id="submit" value="Send">
<input name="reset" type="reset" id="reset" value="Reset">
</tr>
</table>
</form>
</body>
</html>


The sendmail.php
Code:
<?php
// Vars for the form
$name     = $_POST['name'];
$email    = $_POST['email'];
$message = $_POST['msg'];

$msg =  "Name: \t$name\n";
$msg .= "Email: \t$email\n";
$msg .= "Message: \t$message\n\n";

mail("your_email_here","Contact Form",$cabecalho.$msg);
?>
<html>
<head>
<title>Site title</title>
</head>

<body>
<table width="768" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><p>Thank you <?php echo $nome ?>.</p>
</td>
</tr>
</table>
</body>
</html>


Enjoy your code =)
Related topics
I am trying to build a contact form using php and flash
How to code a simple blog using PHP
PHP uploads
How to build PHP mail form with Spam protection
form mail for php
Simple and Detailed Mail Script
Need a simple Contact form
simple php to mysql form doesn't work
[man]Form Mail en PHP
PHP Form Question
php mail and BCC
Looking for easy FormMail Script
neep help making email form that accepts html tags
form mail problems (quality help=frih$)
Need help with submitting form
PHP: Feedback form issues.. help =P
creating guestbooks (form) with php & mysql
Please Help? CGI form mail on my site... only 2 questions!
Form Mail Help Needed
Create a Simple form
How to upload a file via html-form and php?
Can You Get HTML in Your PHP Mail Script?
If you have created a form on your site you can help...
Form Mail help........lol
Reply to topic    Frihost Forum Index -> Miscellaneous -> Tutorials

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2007 Frihost, forums powered by phpBB.