Hello, I have a form that I am testing and
I have some checkbox input fields but when
the form is successfully sent I get “on” word
in the email from my checkbox inputs:
How can I have it so it can say the selection
instead of “On”?
Their is suppose to be a selection. Do I need to put seperate strings on my PHP file
for each checkbox input?
HTML:
<form action="offerengine.php" method="post">
<fieldset>
<legend>Please Complete Form Below</legend>
<h5>*Required Fields</h5>
<input type="text" name="FirstLastName" placeholder="*Name" required="required">
<input type="text" name="CompanyName" placeholder="*Company" required="required"> <br>
<input type="text" name="FullAddress" placeholder="*Address" required="required">
<input type="text" name="FullAddressLineTwo" placeholder="Address Cont." required="required"> <br>
<input type="text" name="CountryName" placeholder="*Country" required="required">
<input type="email" name="EmailAddress" placeholder="*Email" required="required">
<input type="text" name="PhoneNumber" placeholder="*Phone Number" required="required"><br>
<label for="My goods are transported by:">*I currently Use
<input type="checkbox" name="Use" ><label>Don't Use</label>
<input type="checkbox" name="DontUse" ><label>Monitoring Devices</label>
</label>
<label for="Enter G force">*Do you know which G force level you need? Enter G force here: <br><input type="text" name="GForce" required="required" placeholder="Enter g Force"> </label>
<label for="guidance">*OR check the boxes below so we can provide guidance.</label><br>
<label for="My goods are:">My goods are:
<input type="checkbox" name="Fragility" > <label>Very Fragile</label>
<input type="checkbox" name="Fragility"> <label>Moderately Fragile</label>
<input type="checkbox" name="Fragility" > <label>Not Very Fragile</label>
</label>
<label for="My goods are transported by:">*My goods are transported by:
<input type="checkbox" name="Transportation" > <label >Road</label>
<input type="checkbox" name="Transportation" > <label>Rail</label>
<input type="checkbox" name="Transportation" > <label>Ocean</label>
<input type="checkbox" name="Transportation" > <label>Air</label>
</label><br>
<label for="Weight in">*Weight in:</label><br>
<input type="text" name="Weight" placeholder="Ibs"><label>OR</label>
<input type="text" name="Weight2" placeholder="KG" ><br>
<input class="hvr-skew-forward contact-sub" type="submit" name="submit" value="Submit"/>
</fieldset>
</form>
PHP:
<?php
$EmailFrom = "Customer";
$EmailTo = "csosa@iogproducts.com";
$Subject = "Impact-O-Graph Devices Offer Customer Information";
$FirstLastName = Trim(stripslashes($_POST['FirstLastName']));
$CompanyName = Trim(stripslashes($_POST['CompanyName']));
$FullAddress = Trim(stripslashes($_POST['FullAddress']));
$FullAddressLineTwo = Trim(stripslashes($_POST['FullAddressLineTwo']));
$CountryName = Trim(stripslashes($_POST['CountryName']));
$EmailAddress = Trim(stripslashes($_POST['EmailAddress']));
$PhoneNumber = Trim(stripslashes($_POST['PhoneNumber']));
$Use = Trim(stripslashes($_POST['Use']));
$DontUse = Trim(stripslashes($_POST['DontUse']));
$GForce = Trim(stripslashes($_POST['GForce']));
$Fragility = Trim(stripslashes($_POST['Fragility']));
$Transportation = Trim(stripslashes($_POST['Transportation']));
$Weight = Trim(stripslashes($_POST['Weight']));
$Weight2 = Trim(stripslashes($_POST['Weight2']));
// validation
$validationOK=true;
if (!$validationOK) {
print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
exit;
}
// prepare email body text
$Body = "";
$Body .= "Full Name: ";
$Body .= $FirstLastName;
$Body .= "\n";
$Body .= "Company Name: ";
$Body .= $CompanyName;
$Body .= "\n";
$Body .= "Full Address: ";
$Body .= $FullAddress;
$Body .= "\n";
$Body .= "Full Address Cont.: ";
$Body .= $FullAddressLineTwo;
$Body .= "\n";
$Body .= "Country Name: ";
$Body .= $CountryName;
$Body .= "\n";
$Body .= "Email Address: ";
$Body .= $EmailAddress;
$Body .= "\n";
$Body .= "Phone Number: ";
$Body .= $PhoneNumber;
$Body .= "\n";
$Body .= "I Currently Use Monitoring Devices: ";
$Body .= $Use;
$Body .= "\n";
$Body .= "I Currently Don't Use Monitoring Devices: ";
$Body .= $DontUse;
$Body .= "\n";
$Body .= "Fragility: ";
$Body .= $Fragility;
$Body .= "\n";
$Body .= "Transportation: ";
$Body .= $Transportation;
$Body .= "\n";
$Body .= "Weight in lbs.: ";
$Body .= $Weight;
$Body .= "\n";
$Body .= "Weight in KG: ";
$Body .= $Weight2;
$Body .= "\n";
// send email
$success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>");
// redirect to success page
if ($success){
print "<meta http-equiv=\"refresh\" content=\"0;URL=index.html\">";
}
else{
print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
}
?>