Adding additional fields to "message" in PHP form.
I have a form and a mailscript I built with a tutorial. I do want to understand this as I go along as I will be needing this simple form with no verification soon.
Here is the form.
My form:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Page Title</title>
</head>
<body>
<div id="FormDiv" >
<form action="mailscript.php" method="post" name="ContactForm" id="ContactForm">
<table align="center">
<tbody>
<tr>
<td><label for="Subject">Subject:</label>
<br>
<input name="Subject" type="text" id="Subject" form="ContactForm" />
</td>
</tr>
<tr>
<td><label for="Message">Message:</label><br>
<textarea name="Message" cols="45" rows="5" id="Message" form="ContactForm"></textarea>
</td>
</tr>
<tr>
<td>
<label>
<input type="radio" name="RadioGroup1" value="11" id="RadioGroup1_1">
R1op1</label>
<br>
<label>
<input type="radio" name="RadioGroup1" value="12" id="RadioGroup1_2">
R1op2</label>
<br>
<label>
<input type="radio" name="RadioGroup1" value="13" id="RadioGroup1_3">
R1op3
</label>
</td>
</tr>
<tr>
<td>
<label>
<input type="radio" name="RadioGroup2" value="R2_1" id="RadioGroup2_1">
R2op1</label>
<br>
<label>
<input type="radio" name="RadioGroup2" value="R2_2" id="RadioGroup2_2">
R2op2</label>
<br>
<label>
<input type="radio" name="RadioGroup2" value="R2_3" id="RadioGroup2_3">
R2op3
</label>
</td>
</tr>
<td><input name="SubmitButton" type="submit" id="Submit Button" form="ContactForm" value="Send Message" /> </td>
</tr>
</tbody>
</table>
</form>
</body>
</html>
Close my form.
This mailscript sends the subject and message only and it works as long as I don't use a Gmail or similar. Found this out thanks to this forum.
My Script:
<?php
$from="noreply@anydomain.com";
$email="info@anydomain.com";
$subject=$_POST['Subject'];
$message=$_POST['Message'];
mail ( $email, $subject, $message, "From:".$from );
Print "your message has been sent";
?>
Close my script.
My problem comes when I try to add the two radio groups to the email sent by the process. I have tried several options including commas, and even a plus sign which did not set any alarms in dreamweaver, some made to the inbox, some never did. Here is one example of my several attempts.
My script:
<?php
$from="noreply@anydomain.com";
$email="info@anydomain.com";
$subject=$_POST['Subject'];
$message=$_POST['Message']['RadioGroup1']['RadioGroup2'];
mail ( $email, $subject, $message, "From:".$from );
Print "your message has been sent";
?>
Close my script.
Two of the other variations I have tried:
$message=$_POST['Message''RadioGroup1''RadioGroup2']; Which raised a red flag for code.
$message=$_POST['Message'+'RadioGroup1'+'RadioGroup2']; (which sent mail but only a single "I" in the message field.
Other attempts at variations gave other non results. Thanks in advance, hopefully I am close, I do want to understand this as I go along and have put many hours in before I came here, thanks for your patience. Scott
