Select option issue
Posted: Mon Mar 28, 2011 10:33 pm
The code below is a just a sample. What I'm trying to do is when I click on the submit button I would like to have the option selected display. Unfortunately for me I'm getting the option value displayed. Can anyone help me please
Code: Select all
<HTML>
<head>
<title>Test</title>
</head>
<body>
<form name="test" method="post" action="test.php">
<select name="myselect" id="myselect">
<option value="0">Jason</option>
<option value="1">Sonia</option>
<option value="2">John</option>
<input type="submit" value="Submit">
</select>
</form>
</body>
</html>Code: Select all
<?php
$select = $_POST['myselect'];
echo ($select);
?>