Question
Can someone pleaseee tell me what am I doing wrong with this code? The php part changes when I save the entire file as html.
Can someone pleaseee tell me what am I doing wrong with this code? The php part changes when I save the entire file as html. Im not sure what the problem is? Id appreciate a second set of eyes! Thank you!
Is Today Your Birthday?!!
if(isset($_POST['sub']))
{
$mm=$_POST['mm'];
$dd=$_POST['dd'];
$yy=$_POST['yy'];
$dob=$mm ."/".$dd."/".$yy;
$arr=explode('/',$dob);
//$dateTs=date_default_timezone_set($dob); $dateTs=strtotime($dob);
$now=strtotime('today');
if(sizeof($arr)!=3) die('ERROR:please entera valid date');
if(!checkdate($arr[0],$arr[1],$arr[2])) die('PLEASE: enter a valid dob');
if($dateTs>=$now) die('ENTER a dob earlier than today');
$ageDays=floor(($now-$dateTs)/86400);
$ageYears=floor($ageDays/365);
$ageMonths=floor(($ageDays-($ageYears*365))/30);
echo " You are $ageYears years old. "; if($mm==$arr[0]) { if($dd==$arr[1]) echo" Today is your birthday"; } }
?>