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

Popular posts from this blog

Android : Making Listview full screen -

javascript - Parse JSON from the body of the POST -

javascript - Chrome Extension: Interacting with iframe embedded within popup -