I don't often work with forms, so something as trivial as passing a form selection into the same page seems quite challenging. I've checked a bunch of stackoverflow's questions on this, but they never say where to place the _POST
code or they post the code to another page. I know I'm doing something the wrong way, that's probably pretty simple. Can anybody help me out?
numbersPage.php
<?php
session_start();
$_POST['here'];
$hello = $_GET['here'];
echo $hello;
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
</head>
<form name="input" action="numbersPage.php" method="get">
Fav Number:
<select id="">
<optgroup label="Numbers">
<option value="1" name="thing">1</option>
<option value="2" name="thing">2</option>
<option value="3" name="thing">3</option>
<option value="4" name="thing">4</option>
<option value="5" name="thing">5</option>
</optgroup>
</select>
<input type="submit" value="Submit">
</form>
</body>
</html>