Check for URL variable in PHP -
i have php page takes date variable: mypage.php?date=2015-07-14 , displays output.
how check if date= empty , if insert , refresh page current date?
i've tried formulate small script @ top of page using _get date value not sure how handle reload of page?
you can check input not empty using empty
function, , create date
(it default current, unless pass parameter), , passed parameter in header
function same page.
if(empty($_get['date'])) header('location:'.$_server['php_self'].'?date='.date('y-m-d'));
Comments
Post a Comment