fork download
  1. <?php
  2. $value = 'yes';
  3. echo "<input type='checkbox' name='subscribe' value='yes'/>Subscribe?";
  4. if(isset($_POST['subscribe'])){
  5. if($_POST['subscribe'] == $value){
  6. $subscribed = true;
  7. }else{
  8. $subscribed = false;
  9. print 'Invalid checkbox value submitted.';
  10. }
  11. }else{$subscribed = false;}
  12. if($subscribed){
  13. print 'You Are Not Subscribed.';}else{print 'You Are Subscribed.';}
Success #stdin #stdout 0.04s 25660KB
stdin
1
2
10
42
11
stdout
<input type='checkbox' name='subscribe' value='yes'/>Subscribe?You Are Subscribed.