PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Can someone please give me direction or syntax for the last input.
First a form is shown to enable user to select a recipient of an email then the email is sent.
If I leave it without the input type hidden it shows on the form I only want the link to appear in the email that is sent. Currently my email is showing everything else I want but this last input only shows upto <a href=
Cheers
<?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");
// I ADDED BELOW THIS #########################################
$email2 = stripslashes($_POST["email2"]);
if (!empty($email2)) {
exit();
}
// TO HERE #####################################################
$msg="Your attention is required for the following Incident Report:\n";
//if((isset($_POST['value']) && (trim($_POST['value']) != ''))
foreach($_POST as $key => $val){
//if(trim($val) != ''){
if(trim($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== ($_POST['recipient']);
$subject="Incident report requires your attention!";
error_reporting(0);
if (mail($recipient, $subject, $msg)){
echo "<p>Thank you<br/>Notification successfully sent:</p>\n";
//echo nl2br($input);
} else
echo "An error occurred and the message could not be sent.";
} else // echo "Bad request method";
?>
$msg .= "\n\nView this incident online:\nhttp://just4em.com/incident/view_reports.php";
or something similar.
You basically constructing an email message ($msg) from a bunch of submitted form elements. However you don't *only* have to include those elements. You can just add stuff in as you need to.