Skip to content

Instantly share code, notes, and snippets.

@simeondahl
Last active December 10, 2019 23:00
Show Gist options
  • Select an option

  • Save simeondahl/4482698 to your computer and use it in GitHub Desktop.

Select an option

Save simeondahl/4482698 to your computer and use it in GitHub Desktop.
PHP dropdown menu.
0.0.1 -> 0.0.2
general:
- Removed PHP code from index.php
- Added a new file with php code in called "function.php"
0.0.1
general:
- Added the new code to get value of a dropdown box (PHP)
<?php
// here starts the php
if (isset($_POST['show_dowpdown_value'])) {
echo $_POST['dowpdown']; // this will print the value if downbox out
}
?>
<html>
<head>
<title>Sitename</title>
</head>
<body>
<form action="function.php" method="post">
<!-- here start the dropdown list -->
<select name="dowpdown">
<option value="1">Yes</option>
<option value="2">No</option>
</select>
<input type="submit" name="show_dowpdown_value" value="show"/>
</form>
<?php include("function.php"); ?>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment