Last active
March 5, 2017 14:45
-
-
Save nvlled/27f6c35ab9218e1cc9d51ea853e884b9 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 (isset($_REQUEST["action1"])) { | |
$animal = $_REQUEST["animal"]; | |
echo "Selected animal: $animal"; | |
} | |
?> | |
<form method="POST"> | |
<select name="animal"> | |
<option value="dog">dog</option> | |
<option value="cat">cat</option> | |
<option value="cow">cow</option> | |
<option value="pig">pig</option> | |
<input type="submit" name="action1" value="select animal"/> | |
</select> | |
</form> | |
<hr> | |
<?php | |
if (isset($_REQUEST["action2"])) { | |
$colors = $_REQUEST["colors"]; | |
echo "selected colors:<br>"; | |
foreach ($colors as $color) | |
echo "- $color<br>"; | |
} | |
?> | |
<form method="GET"> | |
<select name="colors[]" multiple> | |
<option value="red">red</option> | |
<option value="blue">blue</option> | |
<option value="green">green</option> | |
<input type="submit" name="action2" value="select color"/> | |
</select> | |
</form> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment