Jump to content

Verify date exists


shank888

Recommended Posts

I am making a secure registration for my website and looking for a function that will verify with a user inputted date exists.

 

From my registration html form I am putting a month, day and year , each inputted separately into a single variable:

$bday = $year . "-" . $month . "-" . $day;

 

My birthday input looks like:

 

<div class=\"Container FormBoxLeft\">
  <b>Birthdate:</b>
</div>
<div class=\"Container FormBoxRight\">
  <select name=\"month\"><option value=\"\">-Month-</option>
  <option value=\"01\">January</option>
  <option value=\"02\">February</option>
  <option value=\"03\">March</option>
  <option value=\"04\">April</option>
  <option value=\"05\">May</option>
  <option value=\"06\">June</option>
  <option value=\"07\">July</option>
  <option value=\"08\">August</option>
  <option value=\"09\">September</option>
  <option value=\"10\">October</option>
  <option value=\"11\">November</option>
  <option value=\"12\">December</option>
  </select> 
<select name=\"day\">
<option value=\"\"> -Day-</option>';
//Print 31 Days
";
    for ($x=1; $x<=31; $x++) {
        echo "<option value='".$x."'"; if(isset($_POST['submit']) && $day == $x) { echo " selected"; } echo ">".$x."</option>\n";
    }
echo "</select> 
  <input name=\"year\" size=\"2\" maxlength=\"4\" type=\"text\">

 

So.. What I am asking is.. is there a secure way to check if the date the user inputted exists, or is there a better way to make the form more secure from that part.  Upon finding the users birthdate I am also wanting to check if the user is a certain age.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.