I created a form with HTML and Jquery, and all of the data is being sent to my email, except for the checkboxes. I've tried setting it up in an array, but I must be missing something because it's still not working. Any idea why my checkbox data won't send in the email?
HTML
<div class="form-group">
<label for="text_id" class="control-label">Name</label>
<input type="text" class="form-control" id="text_id" name="name">
</div>
<div class="form-group">
<label for="email_id" class="control-label">Email</label>
<input type="email" class="form-control" id="email_id" name="email">
</div>
<div class="form-group">
<label for="checkbox" id="serviceSelector" />Select The Services You Need</label><br>
<input type="checkbox" name="cleaningService1" value="carpet-cleaning" id="carpet-cleaning-service" name="service[]">Carpet Cleaning<br>
<input type="checkbox" name="cleaningService2" value="upholstery-cleaning" id="upholstery-cleaning-service" name="service[]">Upholstery Cleaning<br>
</div>
PHP
<?php
$name = $_POST['name'];
$email = $_POST['email'];
$service = implode(", ", $_POST['service']) ;
$formcontent="From: $name \n Email: $email \n Services Selected: $service";
$recipient = "-------";
$subject = "Price Quote";
$mailheader = "From: $email \r\n";
mail($recipient, $subject, $formcontent, $mailheader) or die("Error!");
echo "Thank You!";
?>
I'm new to server side languages like PHP, so I'm not very familiar with this. If you see a better way to send the email, please feel free to let me know. Thank you
Aucun commentaire:
Enregistrer un commentaire