title: How to determine if checkbox is selected using PHP?
body: <p>Hello guys I just want to ask what's my wrong with my code because what I am trying to do is determine if checkbox is selected or not. If selected assign it to 'Y' if not to 'N'.
  Here's my code</p>
  
  <h3>HTML</h3>
  
  <pre><code>&lt;input type="checkbox" name="cash_delivery" /&gt;
  </code></pre>
  
  <h3>PHP</h3>
  
  <pre><code>$cash_delivery = $this-&gt;input-&gt;post('cash_delivery');
  
  if(isset($cash_delivery)){
     echo 'Y';
  }else{
     echo 'N';
  }
  
  exit;
  </code></pre>
  
  <p><strong>My problem is if I unchecked the checkbox it return to 'Y' if checked also to 'Y'</strong></p>
  
  <p>That's all guys thanks in advance. By the way I am using Codeigniter</p>