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

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -