Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Checking dates when submitted not functioning

Status
Not open for further replies.

shortkid422

Programmer
Joined
Jan 2, 2004
Messages
8
Location
US
I have this date thing set up so that i can have 2 sets of dates, and what i want to do is when i submit the values, i want to make sure that the first date is before the second date. This is what i have but the funtion test() isnt working.
PHP:
<?
function test()
{
if ($tdoao2 < $tdoao)
{
echo &quot;You cant book a flight to a day before&quot;;
}
else
{
echo &quot;Thank you&quot;;
}
}
?> 
<?
   echo ' 
   <form method=&quot;post&quot; action=&quot;' . $_SERVER['PHP_SELF'] . '&quot;>';
?>
<table>
 <tr>
  <td>
<select name=&quot;doa&quot;>
<?
   $skip = 2;
   while ($skip < 34) {
         $dotw = date(&quot;w&quot;, mktime(0,0,0,date(&quot;m&quot;),date(&quot;d&quot;)+$skip,date(&quot;Y&quot;)));
         switch ($dotw) {
           case 0:
               break;
           case 6:
               break;
           default:
               $tdoao = date(&quot;F jS&quot;, mktime(0,0,0,date(&quot;m&quot;),date(&quot;d&quot;)+$skip, date(&quot;Y&quot;)));
           echo(&quot;<option value='$tdoao'>$tdoao</option>&quot;);
           }
     $skip = $skip + 1;
   }
?>
</select>
  </td>
  <td>
<select name=&quot;doa&quot;>
<?
   $skip = 2;
   while ($skip < 41) {
         $dotw = date(&quot;w&quot;, mktime(0,0,0,date(&quot;m&quot;),date(&quot;d&quot;)+$skip,date(&quot;Y&quot;)));
         switch ($dotw) {
           case 0:
               break;
           case 6:
               break;
           default:
               $tdoao2 = date(&quot;F jS&quot;, mktime(0,0,0,date(&quot;m&quot;),date(&quot;d&quot;)+$skip, date(&quot;Y&quot;)));
           echo(&quot;<option value='$tdoao2'>$tdoao2</option>&quot;);
           }
     $skip = $skip + 1;
   }
?>
</select>
  </td>
 </tr>
 <tr>
  <td></select><input type='submit' value='Search' onsubmit=&quot;test()&quot;></td>
 </tr>
</table>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top