Jump to content
Larry Ullman's Book Forums

Chapter 6 - Pursue


Recommended Posts

Looks like I am a couple years behind on this thread, but I thought I would post my findings on problem 5 from the Pursue section.
 
On register.php, I changed the value to zero for default selection on month and day.

<p>Date Of Birth: <select name ="month">
     <option value = "0">Month</option>
     <option value = "1">January</option>
<select name = "day">
<option value ="0">Day</option>
<?php // Print out 31 days:

On handle_reg.php, I defined the posted variables and then combined them into a single variable.

 

$dbm = $_POST['month'];
$dbd = $_POST['day'];
$dby = $_POST['year'];
$birth_date = $dbm . '/' . $dbd . '/' .$dby;

I then ran the checkdate function to verify the fields.

 

if (checkdate($dbm, $dbd, $dby) != true) {
print '<p class ="error">Please enter your full date of birth</p>';
$okay =FALSE;
}

Does this look good Larry? Thanks as well for writing this book! Can't wait to get to the next ones! 

 

Jesse

Link to comment
Share on other sites

 Share

×
×
  • Create New...