Last active
May 21, 2019 19:26
-
-
Save PatricNox/15db40b27fe4d69b0169b76e04c534b0 to your computer and use it in GitHub Desktop.
Example: Checkbox with values PHP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// If they selected the first checkbox! | |
if (isset($_POST['checkbox_1']) { | |
echo "You selected: $_POST['checkbox_1']"; | |
} | |
// If they selected the second checkbox! | |
if (isset($_POST['checkbox_1'])) { | |
echo "You selected: $_POST['checkbox_1']"; | |
} | |
?> | |
<!DOCTYPE html> | |
<html> | |
<!-- You need to wrap this inside a form, for the POST method. --> | |
<form action="#" method="POST"> | |
<!-- The text inside "name" will be the text inside $POST[] array --> | |
<!-- while the text inide "value" will be the actual value. --> | |
<!-- Try change value and see the effect! --> | |
<input type="checkbox" name="checkbox_1" value="checkbox_1" /> | |
<input type="checkbox" name="checkbox_2" value="checkbox_2" /> | |
<input type="submit"> | |
</form> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment