text: Q:
  
  how to create condition in php with and / or
  
  I am trying to make a condition in php for this situation:
  You can choose for a radio input or checkbox input. 
  No matter what you choose, but if you choose one of them, it may not be empty.
  $quickpolltype = "radio"; // set to "radio" or "checkbox"; radio is one choice, checkbox is multiple choices
  
  I have seperated the 2 conditions now like below:
  if($quickpolltype == "radio" and $_POST['radiovote'] != '') {
  // do something
  }
  if($quickpolltype == "checkbox" and $_POST['checkboxvote'] != '') {
  // do something
  }
  
  what i want to achieve:
  No matter what you choose as type in $quickpolltype, if the value of one of them is not empty --> do something
  So how can i combine those 2 conditions in 1 condition, whatever quickpolltype is choosen?
  
  A:
  
  First it is advisable to use && and || see here 'AND' vs '&&' as operator
  Also you are doing an assignment = and not a comparison ==.
  So you want something like:
  if($quickpolltype == "radio" && $_POST['radiovote'] != '') {
      // do something
  }
  if($quickpolltype == "checkbox" && $_POST['checkboxvote'] != '') {
      // do something
  }
  
  Essentially you were making $quickpolltype "radio" rather then checking if it was equal to it. Same for "checkbox".
  To make all of that in one if
  if(($quickpolltype == "radio" && $_POST['radiovote'] != '') 
      || ($quickpolltype == "checkbox" && $_POST['checkboxvote'] != '')){
      //Do stuff
  }
  
  A:
  
  If the "do something" is going to be the same, you can certainly combine the two conditions. If not, keep them separate.
  if(($quickpolltype=="radio" && $_POST['radiovote'] != '') || ($quickpolltype="checkbox" && $_POST['checkboxvote'] != '')) {
      //do something
  }
  
  Make sure that when comparing things in PHP, you are using "=="! Additionally, you may want to be careful of using "and" and "or" instead of "&&" and "||" in PHP. 
  
  