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 submiited.';
  10. }
  11. } else {
  12. $subscribed = false;}
  13. if ($subscribed){
  14. print 'You Are Subscribed';
  15. }else{
  16. print 'You Are Not Subscribed';}
  17. ?>
Success #stdin #stdout 0.02s 25772KB
stdin
1
2
10
42
11
stdout
<input type='checkbox' name='subscribe' value='yes'/>Subscribe?You Are Not Subscribed