I am trying to create a check list that allows users to check off each item they want and then send an email to their chosen email. I am using JQueryMobile and I don't know if it's causing any problems, but the page just keeps on loading continuously when I press submit.
This is my HTML code:
<form name="emailform" enctype="multipart/form-data" action="form-to-email.php" method="post">
<div data-role="fieldcontain">
<label for='name'>Festival name: </label><br>
<input type="text" name="name">
<h3>
Essentials
</h3>
<fieldset data-role="controlgroup" data-type="vertical">
<legend>
</legend>
<input name="checkbox1" id="checkbox1" type="checkbox" />
<label for="checkbox1">
Tickets
</label>
<input name="checkbox2" id="checkbox2" type="checkbox" />
<label for="checkbox2">
Parking pass
</label>
<input name="checkbox3" id="checkbox3" type="checkbox" />
<label for="checkbox3">
Directions
</label>
<input name="checkbox4" id="checkbox4" type="checkbox" />
<label for="checkbox4">
Cash & Cards
</label>
<input name="checkbox5" id="checkbox5" type="checkbox" />
<label for="checkbox5">
Keys
</label>
</fieldset>
<label for='email'>Send to Email:</label><br>
<input type="text" name="email">
<input name="share" type="submit" value="Share">
</form>
And this is my PHP:
<?php
if(!isset($_POST['submit'])){
if (!$_POST['name'] | !$_POST['email'])
{
echo"<div class='error'>Error<br />You did not fill in a required field, please review your form and correct the missing information.</div>";
}
}
$name = $_POST['name'];
$email = $_POST['email'];
$checkbox1 = $_POST['checkbox1'];
$email_from = "Application";
$email_subject = $name;
$email_body = "You have received a new checklist via App.\n".
"Here is the checklist so far:\n $checkbox1".
$headers = "From: $email_from \r\n";
mail($email, $email_subject,$email_body,$headers);
header('Location: index.html');
?>