in another words, i have an drop-down list:
<select name="gamelist" id="gamelist">
<option value="1">Backgammon</option>
<option value="2">Chess</option>
</select>
<input type="submit" name="submit" id="submit" value="Submit" />
what i want to do is to echo out Backgammon or Chess based on their values and on witch one is selected. here is what i have so far. but i get numbers instead of names
$values = $_POST['gamelist'];
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
if (isset($_POST['submit']) && ($_POST['submit'] == 'Submit')) {
echo $values;
}
}
thanks
In
$_POST['gamelist']you should have ‘1’ or ‘2’.To display it, you should use something similar to the following:
This should definitely work.
FYI: The part contained within the
<option>tag is not being passed with form data, only the values assigned withinvalueattributes to chosen options.