Ive got a form where users report posts
<form method="post" action="sendmail.php" name="Email form">
Message ID <input type="text" name="message id" /><br/><br/>
Aggressive conduct <input type="radio" name="option1" value="aggressive contact" /><br/><br/>
Offensive conduct <input type="radio" name="option2" value="offensive conduct" /><br/><br/>
Rasical conduct <input type="radio" name="option3" value="Rasical conduct" /><br/><br/>
Intimidating conduct <input type="radio" name="option4" value="intimidating conduct" /><br/><br/>
<input type="submit" name="submit" value="Send Mail" />
</form>
And then it fires a php mail function which send the report to me
<?php
$to = 'root@localhost';
$subject = 'Report';
$message = 'message id\option1\option2\option3\option4';
$headers = 'From: postmaster@localhost' . "\r\n" .
'Reply-To: postmaster@localhost' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
?>
I want it to take the values inputted by users in the form and mail them to me. As it stands its DOES send a mail but it just say in the mail
message id\option1\option2\option3\option4
Now i understand this is what i put in for ‘$message’ but as this is what i called the input in the form i thought this is what it would take! What am i missing to do this?
The php mail function IS working so this is not the problem. Im sure im just missing some code to get it working.
Message ID <input type="text" name="message id" /><br/><br/>the name attribute here is incorrect and will need to be renamed to “message_id” instead.
Your radio buttons should have the same name (eg. “conduct”)
and then change
to something like this: