Guest User

Untitled

a guest
May 24th, 2018
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.49 KB | None | 0 0
  1. <?php
  2.  
  3. if (isset($_POST["checkboxInput"])) {
  4. if (in_array("value1",$_POST["checkboxInput"])) {
  5. echo "This is value 1<br/>";
  6. }
  7. if (in_array("value2",$_POST["checkboxInput"])) {
  8. echo "This is value 2<br/>";
  9. }
  10. if (in_array("value3",$_POST["checkboxInput"])) {
  11. echo "This is value 3<br/>";
  12. }
  13. if (in_array("value4",$_POST["checkboxInput"])) {
  14. echo "This is value 4<br/>";
  15. }
  16. }
  17. ?>
  18.  
  19. <form method="post">
  20. <input type="checkbox" name="checkboxInput[]" value="value1">Value 1<br/>
  21. <input type="checkbox" name="checkboxInput[]" value="value1">Value 1<br/>
  22. <input type="checkbox" name="checkboxInput[]" value="value1">Value 1<br/>
  23. <input type="checkbox" name="checkboxInput[]" value="value1">Value 1<br/>
  24. <input type="submit" value="submit"/>
  25. </form>
  26.  
  27. <?php
  28.  
  29. if (isset($_POST["radioGroup1"]) || isset($_POST["radioGroup2"])) {
  30. echo "Group 1 value: ".$_POST["radioGroup1"]."<br/>";
  31. echo "Group 2 value: ".$_POST["radioGroup2"];
  32. }
  33. ?>
  34.  
  35. <form method="post">
  36. <div>
  37. <input type="radio" name="radioGroup1" value="radio1">Радио 1</input>
  38. <input type="radio" name="radioGroup1" value="radio2">Радио 2</input>
  39. </div>
  40.  
  41. <div>
  42. <input type="radio" name="radioGroup2" value="radio3">Радио 3</input>
  43. <input type="radio" name="radioGroup2" value="radio4">Радио 4</input>
  44. </div>
  45. <input type="submit" value="submit"/>
  46. </form>
Add Comment
Please, Sign In to add comment