Forum Moderators: coopster
Once you've customised your code, come back to WebmasterWorld PHP forum [webmasterworld.com] and ask any question that you like / have problem with.
<?php
if ($_SERVER['REQUEST_METHOD']=="POST"){
// In testing, if you get an Bad referer error
// comment out or remove the next three lines
if (strpos($_SERVER['HTTP_REFERER'], $_SERVER['HTTP_HOST'])>7 ¦¦
!strpos($_SERVER['HTTP_REFERER'], $_SERVER['HTTP_HOST']))
die("Bad referer");
$msg="Values submitted by the user:\n";
foreach($_POST as $key => $val){
if (is_array($val)){
$msg.="Item: $key\n";
foreach($val as $v){
$v = stripslashes($v);
$msg.=" $v\n";
}
} else {
$val = stripslashes($val);
$msg.="$key: $val\n";
}
}
$recipient="<snip>";
$subject="<snip>";
error_reporting(0);
if (mail($recipient, $subject, $msg)){
echo "<center><h1>Thank you</h1><p>Message successfully sent!</p></center>\n";
echo nl2br($input);
} else
echo "An error occurred and the message could not be sent.";
} else
echo "Bad request method";
?>
[edited by: trillianjedi at 4:00 pm (utc) on Aug. 15, 2006]
[edit reason]
[1][edit reason] No specifics please ;) [/edit] [/edit][/1]
specifically
Basics of Submitting and Emailing Forms with PHP [webmasterworld.com]
Combatting Webform hijack [webmasterworld.com]