Title: 404 Error When Form Is Submitted
Last modified: August 30, 2016

---

# 404 Error When Form Is Submitted

 *  Anonymous User
 * (@anonymized-3905352)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/404-error-when-form-is-submitted/)
 * Hi,
 * I’m attempting to validate a birthday. When I let the user choose there birthday
   and press “submit” I’m getting a 404 error message. I don’t know why this is 
   the case. I was hoping someone can look at my below syntax and tell me what you
   think I’m doing wrong.
 * Thanks
 * Syntax
 * HTML
 *     ```
       <form action="" id="contactFormUs" name="contactFormUs" method="post" class="forms-contact formsec">
   
       	  <div class="pro_fields">
                 <li>
                   <label for="first_Name">
                     <?php _e('First Name:','language');?>
                   </label>
                   <br/>
                   <?php $first_Name = $_POST['first_Name'];
       				if($first_Name != '' && $first_Name != 'Please Enter Your First Name'){
       				$first_Name = $_POST['first_Name'];
       				$first_Name_Submitted = trim_and_cap_it_out($_POST['first_Name']);
       			}
                   ?>
                   <input type="text" name="first_Name" id="first_Name" class="field" value="<?php echo $first_Name_Submitted; ?>"/>
                   <?php if($first_name_error != '') { ?>
                   <span class="error">
                   <?=$first_name_error;?>
                   </span>
                   <?php } ?>
                 </li>
               </div>
   
       		<div class="pro_fields">
                 <li>
                   <label for="birthday">
                     <?php _e('Birthday:','language');?>
                   </label>
                   <br/>
   
       			<select name="month" id="month" style="width:200px">
       			<option value="0">--Select A Month--</option>
       				<option <?php if ($_REQUEST['month'] == 1) { ?>selected="true" <?php }; ?>value="January">January</option>
       				<option <?php if ($_REQUEST['month'] == 2) { ?>selected="true" <?php }; ?>value="February">February</option>
       				<option <?php if ($_REQUEST['month'] == 3) { ?>selected="true" <?php }; ?>value="March">March</option>
       				<option <?php if ($_REQUEST['month'] == 4) { ?>selected="true" <?php }; ?>value="April">April</option>
       				<option <?php if ($_REQUEST['month'] == 5) { ?>selected="true" <?php }; ?>value="May">May</option>
       				<option <?php if ($_REQUEST['month'] == 6) { ?>selected="true" <?php }; ?>value="June">June</option>
       				<option <?php if ($_REQUEST['month'] == 7) { ?>selected="true" <?php }; ?>value="July">July</option>
       				<option <?php if ($_REQUEST['month'] == 8) { ?>selected="true" <?php }; ?>value="August">August</option>
       				<option <?php if ($_REQUEST['month'] == 9) { ?>selected="true" <?php }; ?>value="September">September</option>
       				<option <?php if ($_REQUEST['month'] == 10) { ?>selected="true" <?php }; ?>value="October">October</option>
       				<option <?php if ($_REQUEST['month'] == 11) { ?>selected="true" <?php }; ?>value="November">November</option>
       				<option <?php if ($_REQUEST['month'] == 12) { ?>selected="true" <?php }; ?>value="December">December</option>
       			</select>
   
       			<select name="day" id="day" style="width:200px">
       				<option value="0">--Select A Day--</option>
       				<option <?php if ($_REQUEST['day'] == 1) { ?>selected="true" <?php }; ?>value="1">1</option>
       				<option <?php if ($_REQUEST['day'] == 2) { ?>selected="true" <?php }; ?>value="2">2</option>
       				<option <?php if ($_REQUEST['month'] == 3) { ?>selected="true" <?php }; ?>value="3">3</option>
       				<option <?php if ($_REQUEST['month'] == 4) { ?>selected="true" <?php }; ?>value="4">4</option>
       				<option <?php if ($_REQUEST['month'] == 5) { ?>selected="true" <?php }; ?>value="5">5</option>
       				<option <?php if ($_REQUEST['month'] == 6) { ?>selected="true" <?php }; ?>value="6">6</option>
       				<option <?php if ($_REQUEST['month'] == 7) { ?>selected="true" <?php }; ?>value="7">7</option>
       				<option <?php if ($_REQUEST['month'] == 8) { ?>selected="true" <?php }; ?>value="8">8</option>
       				<option <?php if ($_REQUEST['month'] == 9) { ?>selected="true" <?php }; ?>value="9">9</option>
       				<option <?php if ($_REQUEST['month'] == 10) { ?>selected="true" <?php }; ?>value="10">10</option>
       				<option <?php if ($_REQUEST['month'] == 11) { ?>selected="true" <?php }; ?>value="11">11</option>
       				<option <?php if ($_REQUEST['month'] == 12) { ?>selected="true" <?php }; ?>value="12">12</option>
       				<option <?php if ($_REQUEST['month'] == 13) { ?>selected="true" <?php }; ?>value="13">13</option>
       				<option <?php if ($_REQUEST['month'] == 14) { ?>selected="true" <?php }; ?>value="14">14</option>
       				<option <?php if ($_REQUEST['month'] == 15) { ?>selected="true" <?php }; ?>value="15">15</option>
       				<option <?php if ($_REQUEST['month'] == 16) { ?>selected="true" <?php }; ?>value="16">16</option>
       				<option <?php if ($_REQUEST['month'] == 17) { ?>selected="true" <?php }; ?>value="17">17</option>
       				<option <?php if ($_REQUEST['month'] == 18) { ?>selected="true" <?php }; ?>value="18">18</option>
       				<option <?php if ($_REQUEST['month'] == 19) { ?>selected="true" <?php }; ?>value="19">19</option>
       				<option <?php if ($_REQUEST['month'] == 20) { ?>selected="true" <?php }; ?>value="20">20</option>
       				<option <?php if ($_REQUEST['month'] == 21) { ?>selected="true" <?php }; ?>value="21">21</option>
       				<option <?php if ($_REQUEST['month'] == 22) { ?>selected="true" <?php }; ?>value="22">22</option>
       				<option <?php if ($_REQUEST['month'] == 23) { ?>selected="true" <?php }; ?>value="23">23</option>
       				<option <?php if ($_REQUEST['month'] == 24) { ?>selected="true" <?php }; ?>value="24">24</option>
       				<option <?php if ($_REQUEST['month'] == 25) { ?>selected="true" <?php }; ?>value="25">25</option>
       				<option <?php if ($_REQUEST['month'] == 26) { ?>selected="true" <?php }; ?>value="26">26</option>
       				<option <?php if ($_REQUEST['month'] == 27) { ?>selected="true" <?php }; ?>value="27">27</option>
       				<option <?php if ($_REQUEST['month'] == 28) { ?>selected="true" <?php }; ?>value="28">28</option>
       				<option <?php if ($_REQUEST['month'] == 29) { ?>selected="true" <?php }; ?>value="29">29</option>
       				<option <?php if ($_REQUEST['month'] == 30) { ?>selected="true" <?php }; ?>value="30">30</option>
       				<option <?php if ($_REQUEST['month'] == 31) { ?>selected="true" <?php }; ?>value="31">31</option>
       			</select>
   
       			<!--<select name="year" id="year" style="width:200px">
       				<option value="0">--Select A Year--</option>
       				<?php for($i=date("1900"); $i<=date("1997")+2; $i++)
       						if($year == $i)
       							echo '<option value='.$i.' selected="true">'.$i.'</option>';
       						else
       							echo '<option value='.$i.'>'.$i.'</option>';
       				?>
       			</select>-->
   
                   <?php if($birthdayNumberError != '0') { ?>
                   <span class="error">
                   <?=$birthdayNumberError;?>
                   </span>
                   <?php } ?>
                 </li>
               </div>
   
              <div class="pro_fields">
                 <div style="clear:both"></div>
                 <input type="submit" name="submitted" id="submitted" class="send-contact" value="Send"/>
                 <div style="clear:both"></div>
               </div>
   
               	<hr>
               </div>
   
             </form>
       ```
   
 * PHP Syntax
 *     ```
       if(isset($_POST['submitted'])) {	
   
       	function validate_information($string){
       		if(trim($string) === '' && empty($string)){
       			return true;
       		} else {
       			return false;
       		}
       	}
   
       	function validate_singleDropDownMenus($string){
       		if(isset($string) && $string === '0' ){
       			return true;
       		} else {
       			return false;
       		}
       	}
   
       	function trim_and_cap_it_out($string){
       		$trimmed = trim($string);
       		$lowerCase = strtolower($trimmed);
       		$uppercaseValue = ucfirst($lowerCase);
       		return $uppercaseValue;
       	}
   
       	$first_Name = $_POST['first_Name'];
           if(validate_information($first_Name)){
       	  $first_name_error = __('<span STYLE="font-size: x-medium; color: #000000">Enter Your First Name</span>','language');
             $error_message .= 'Enter Your First Name\n';
             $hasError = true;
           } else {
             $first_Name = trim($first_Name);
       	  $first_Name = strtolower($first_Name);
       	  $first_Name = ucfirst($first_Name);
           }
   
       	$month			= $_REQUEST['month'];
       	$day 			= $_REQUEST['day'];
       	$year		  	= $_REQUEST['year'];
   
       	// var_dump($month);
       	// var_dump($day);
       	// die(); 
   
       	if(checkdate($month,$day,$year)){
       		//$dob is a valid date
       		echo "<p>Date of birth:$day $month $year</p>";
       	} else {
       		//$dob is a not valid date
       		$day = null;
       		$month = null;
       		$year = null;
       		echo "<p><b><font color=red>Please enter a <mark>valid</mark> date of birth!</font></b></p>";
       	}
       }
       ```
   

Viewing 3 replies - 1 through 3 (of 3 total)

 *  [mkoenen](https://wordpress.org/support/users/mkoenen/)
 * (@mkoenen)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/404-error-when-form-is-submitted/#post-6703942)
 * Have you thought about using a ready-made jquery datepicker?
 *  Thread Starter Anonymous User
 * (@anonymized-3905352)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/404-error-when-form-is-submitted/#post-6703943)
 * Hi mkoenen,
 * Thanks for your email and help. To answer your question, no I haven’t. Is it 
   simpler/more user friendly?
 * I found a solution to a question that was asked years ago at the below URL
 * [https://wordpress.org/support/topic/404-pops-after-custom-form-submission-by-post?replies=12](https://wordpress.org/support/topic/404-pops-after-custom-form-submission-by-post?replies=12)
 * Thanks
 *  [Raghwendra Narayan Ojha](https://wordpress.org/support/users/wdraghwendra/)
 * (@wdraghwendra)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/404-error-when-form-is-submitted/#post-6704141)
 * I got this problem in my form and i think there is the problem in naming of input
   field location or area. I change both form input field name and the 404 error
   has gone.
 * So Please we keep attention regarding the reserved terms of wordpress. The list
   of reserve terms is here [https://codex.wordpress.org/Reserved_Terms](https://codex.wordpress.org/Reserved_Terms).

Viewing 3 replies - 1 through 3 (of 3 total)

 The topic ‘404 Error When Form Is Submitted’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 3 replies
 * 3 participants
 * Last reply from: [Raghwendra Narayan Ojha](https://wordpress.org/support/users/wdraghwendra/)
 * Last activity: [10 years, 5 months ago](https://wordpress.org/support/topic/404-error-when-form-is-submitted/#post-6704141)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
