hi all, just need some quick help, i think it is simple. I have made a php form, it all works fine, however i need the main message to display several of the form elements. the code currently looks like this <?php $to = "someone@hotmail.com"; $from = $_REQUEST['Lname']; $subject = $_REQUEST['Lname']; $email = $_REQUEST['Fname'] ; $message = $_REQUEST['what'] ; $headers = "From: $email"; $sent = mail($to, $subject, $message, $headers) ; if($sent) {print "Your mail was sent successfully"; } else {print "We encountered an error sending your mail"; } ?> PHP: however........... in the $message section i would like to have several elements included. eg. what, Fname, Lname. how do i code this. i assume it would be something like........ $message = $_REQUEST['what', 'Fname', 'Lname'] ; PHP: but cant get it to work. any help would be appreciated.
$message = "{$_REQUEST['what']} some text or whatever {$_REQUEST['Fname']} etc.... la la la ... {$_REQUEST['Lname']}"; PHP:
Alternately : $message = $_REQUEST['what'] ; $message = "From:".$from."\n".$message ; PHP: try that . . to add more varibles . .just follow the same format eg : $message = "From:".$from."Lastname:"$lname . $message ; PHP:
Don't do this. Nothing should go in the headers unless you know it is clean. As it is now, people can use your form to send any spam message to any email address (or even to a thousand email addresses at a time), including virus attachments. In the very least, do something like this: $email = $_REQUEST['Fname']; $email = preg_replace('/[^\w@\.+\-]/', '', $email); $headers = "From: {$email}"; PHP: