By the way, that is not the most efficient way to do it. I just realized that this will open up the email program on the tipster's computer before they send it. Here is one that makes it a lot easier for them, but it will require more steps.
First enter this code into your html page where you want it to appear:
< form method="POST" action="atip.php" >
< h4 >Anonymous Tip< /h4 >
< textarea name="Tips" rows="10" style="width:135px;" >< /textarea >
< /br >
< input type="submit" name="submit" value="Submit" style="font-size:9px;background-color:#fff;" >
< /form >
Now create a php page and call it atip.php. Enter the code below into the page:
< ?php
$EmailFrom = "
[email protected]"; <------You could change this to something more to your liking but you don't have to.
$EmailTo = "
[email protected]"; <-----Replace with your email address.
$Subject = "Someone has an anonymous tip";
$Tip = Trim(stripslashes($_POST['Tips']));
// validation
$validationOK=true;
if (!$validationOK) {
print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
exit;
}
// prepare email body text
$Body = "";
$Body .= "Tip: ";
$Body .= $Tip;
$Body .= "\n";
// send email
$success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>");
// redirect to success page
if ($success){
print "<meta http-equiv=\"refresh\" content=\"0;URL=ok.html\">";
}
else{
print "<meta http-equiv=\"refresh\" content=\"0;URL=error.html\">";
}
? >
Now you have one last step:
All you have to do is create an ok.html page and an error.html page.
This just alerts the tipster that is went through or it didn't.