Filename: feedback.php
<html>
<head>
<title> Feedback Script </title>
</head>
<body bgcolor="#000000" text="#0000CC">
<?
// If coming back from submit, send the mail!
if($_POST)
{ // Get the senders IP
$ip = getenv("REMOTE_ADDR");
// Put the e-mail message together
$email = "Sender Name:\t".$_POST['name']."\nSender E- Mail:\t".$_POST['useremail']."\nIP:\t{$ip}\n\nMessage:\t".$_POST['message']."\n\n";
// Sends the mail to this e-mail address
$to = "you@yourmail.com";
// Gets the e-mail subject from below
$subject = $_POST['subject'];
// Sets the From to whichever e-mail address they entered
$mailheaders = "From: $name <".$_POST['useremail']."> \n";
// Same as the comment above but this is for repling
$mailheaders .= "Reply-To: ".$_POST['useremail']."\n\n";
// Puts the e-mail together and sends it off!
mail($to, $subject, $email, $mailheaders);
//Type the site address you wish to redirect them to once they send the feedback, below.
header("Location: http://www.somesiteaddresshere.com/");
// If not coming back from submit, display the form for them to fill out
}
else
{
//The rest is just the form for the user to fill out
?>
<form method=post action="feedback.php">
<table width="300" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="108">
Your Name:
</td>
<td width="192">
<input type="text" name="name">
</td>
</tr>
<tr>
<td width="108">
Your E-mail:
</td>
<td width="192">
<input type="text" name="useremail">
</td>
</tr>
<tr>
<td width="108">
Your Subject:
</td>
<td width="192">
<select name="subject">
<option value="Website Errors">
Website Trouble
<option value="Sales Question">
Sales Question
<option value="Other">
Other
</select>
</td>
</tr>
<tr>
<td width="108" valign="top">
Message:
</td>
<td width="300">
<textarea name="message" ></textarea>
</td>
</tr>
<tr>
<td width="108"> </td>
<td width="192">
<input type="submit" name="Submit" value="Send Form">
</td>
</tr>
</table>
</form>
<? } ?>
</body>
</html>
Good luck!
