I'm working on a class project and I need a functioning form. I'm trying to get it to work, but every time I hit the submit button, it takes me to a blank page. I know something is wrong, because I found other questions on this topic, but none of the answers there helped. So here's what I've got (an abridged version to condense things):
HTML:
Email address*:<br> <input type="text" name="email" required>
<br>
</fieldset>
<br>
<br>
<fieldset>
<legend>Room Information</legend>
Which room would you like us to reserve for you?<br>
<select name="Room">
<option value="TeaRoom">The Tea Room</option>
<option value="CaptainsSuite">The Captain's Suite</option>
<option value="GreenRoom">The Green Room</option>
<option value="Valentine">The Valentine Suite</option>
<option value="Turkish">The Turkish Delight</option>
<option value="Music">The Music Room</option>
<option value="Bridal">The Bridal Suite</option>
<option value="GuestCottage">The Guest Cottage</option>
</select>
<br><br>
How many people are in your party?<br>
<input type="radio" name="number" value="1">1<br>
<input type="radio" name="number" value="2">2<br>
<input type="radio" name="number" value="3">3<br>
<input type="radio" name="number" value="4">4<br>
<br><br>
Date of Check In:<br> <input type="text" name="checkindate"><br>
<br>
Date of Check Out:<br><input type="text" name="checkoutdate">
<br>
<br>
Do you, or anyone in your party, have any special dietary requirements?<br>
<textarea rows="4" cols="50" name="comment">
</textarea>
<br>
</fieldset>
<br>
<br>
<input type="submit" value="Submit">
PHP:
<?php
$field_name = $_POST['name'];
$field_address = $ POST ['address'];
$field_city = $ POST ['city'];
$field_homephone = $ POST ['homephone'];
$field_cellphone = $ POST ['cellphone'];
$field_email = $_POST ['email'];
$field_Room = $ POST ['Room'];
$field_checkindate = $ POST ['checkindate'];
$field_checkoutdate = $ POST ['checkoutdate'];
$field_comment = $ POST ['comment'];
$radio_button = $_POST['number'];
$drop_down_item = $_POST['state'];
$mail_to = 'email@student.umuc.edu';
$subject = 'Reservation '.$field_name;
$body_message = 'From: '.$field_name."\n";
$body_message .= 'E-mail: '.$field_email."\n";
$body_message .= 'Message: '.$field_message;
$headers = 'From: '.$field_email."\r\n";
$headers .= 'Reply-To: '.$field_email."\r\n";
$mail_status = mail($mail_to, $subject, $body_message, $headers);
if ($mail_status) { ?>
<script language="javascript" type="text/javascript">
alert('Thank you for the message. We will contact you shortly with your confirmation.');
window.location = 'contactpage.html';
</script>
<?php
}
else { ?>
<script language="javascript" type="text/javascript">
alert('Message failed. Please, send an email to eburns15@studentumuc.edu');
window.location = 'contactpage.html';
</script>
<?php
}
?>
EDIT: I realize this is a duplicate question. I'm asking this because I want to know specifically what I'm doing wrong, as the question this has been duplicated as does not help me whatsoever.