Skip to content

Instantly share code, notes, and snippets.

@michaeluno
Created December 29, 2013 08:34
Show Gist options
  • Save michaeluno/8168606 to your computer and use it in GitHub Desktop.
Save michaeluno/8168606 to your computer and use it in GitHub Desktop.
A PHP form demo to show the data structure of the submitted select fields.
<?php
if ( isset( $_POST['save'] ) )
die( '<pre>' . print_r( $_POST, true ) . '</pre>' );
?>
<html>
<body>
<form accept-charset="UTF-8" action="" method="post">
<select name="single_select" size="1" >
<option value="apple">Apple</option>
<option value="banana">Banana</option>
<option value="cherry">Cherry</option>
</select>
<br />
<select name="multiple_selects[]" multiple="multiple">
<option value="one">One</option>
<option value="two">Twp</option>
<option value="three">Three</option>
</select>
<input class="button primary" name="save" type="submit" value="Save" />
</form>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment