forms html php

HTML Form – PHP Email with custom messages and tickbox

I have a HTML form with radio buttons, option boxes (drop down boxes), checkboxes, text fields and so on. I have the form pointed to another file called send.php to email the form on but how would I do this with the tickboxes and radio buttons and input text in between each answer? I would kind of like to format it like this:

Welcome: {name}
Your age group it between: {radio button with age groups}

And so on. I can’t give you the actual code as it is private but I can give this instead which uses the kind of code and format:

<form action="send.php">

<input type="radio" name="AgeGroup" value="AgeGroup1"> 0-18<br>
<input type="radio" name="AgeGroup" value="AgeGroup2"> 19-29<br>
<input type="radio" name="period" value="AgeGroup3"> 30-39<br>
<input type="radio" name="period" value="AgeGroup4"> 40-49<br>
<input type="radio" name="period" value="AgeGroup5"> 50+<br>


<select name="Country">
<option value ="UK">United Kingdom</option>
<option value ="USA">United States</option>



<input type="text" name="PostCode" size="5">


<input type="text" name="HouseNumber" size="5">


<textarea id="Family" class="input" name="FamilyNumber" rows="10" cols="60"></textarea>


<input type="checkbox" name="Delievery" value="NextDay"> Next Day Delievery
<input type="checkbox" name="Delievery" value="TwoToFive"> 2-5 Day
<input type="checkbox" name="Outcome" value="Dismissed"> Dismissed


<center><button id="Send" type="submit" style="height:25px; width:100px; background-color: grey">Send</button></center>


Sorry it’s so random. I ran out of ideas! Also sorry for my coding abilities, I don’t normally do HTML!


I’m hoping this will help…if I’m understanding your question correctly.

Make sure to add a method to your form tag. For example:
<form action="send.php" method="post">. In send.php, you want to grab your variables by name attribute, for example:

$name = $_POST['Name'];
$ageGroup = $_POST['AgeGroup'];

And then you want to build out your email. PHP allows variables to be parsed in double quote strings, which can help you build your message the way you want it. (Reference)

$to = "[email protected]";
$subject = "Subject goes here";
$message = "Welcome: $name. Your age group is between: $ageGroup";
//note: headers are optional
$headers = "From: [email protected]" . "\r\n" . "CC: [email protected]";
mail($to, $subject, $message, $headers);

This is just a simple example, but this might be able to get you started.