php - Get Output Status of Data in Database -
i have problem getting results if condition data in database.
the data checkbox-submitted data. if users check checkbox, value "yes." when users uncheck checkbox, value '' (empty).
let's checkbox data : $checkbox , have conditional php code below. want show header of website based on checkbox status using these conditions:
- if $checkbox set 'yes' header show.
- if $checkbox not set before (there no $checkbox value in database), header show too.
- if $checkbox '', header not showing.
i tried this:
if ( $checkbox == 'yes' || $checkbox == xxx ) {     // show header } else {     // don't show header } and this:
if ( $checkbox == 'yes' || $checkbox = undefined ) {     // show header } else {     // don't show header } but still doesn't work expected: when $checkbox '', php reports $checkbox undefined too. 
how can check condition (xxx) check data not set before if $checkbox set, condition different?
maybe simple as:
if (isset($_post['yourcheckboxname']) && $_post['yourcheckboxname'] == 'yes') {    // show header } else {    // don't  } anyway, who's $checkbox ?  
Comments
Post a Comment