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:

  1. if $checkbox set 'yes' header show.
  2. if $checkbox not set before (there no $checkbox value in database), header show too.
  3. 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

Popular posts from this blog

user interface - Python attempting to create a simple gui, getting "AttributeError: 'MainMenu' object has no attribute 'intro_screen'" -

jquery - Common JavaScript snippet to share files on Google Drive, Dropbox, Box.net or SkyDrive -

Android Gson.fromJson error -