I'm trying to get the selected value from a "SELECT" tag.
but whatever do i get the following error
My code:
<?php require '../db/connection.php';
include '../db/functions.php';
session_start();
?>
<html>
<head>
<title>Project Pocket</title>
<link rel="stylesheet" type="text/css" href="default.css">
</head>
<body>
<h1>Welcome!</h1>
<div class="cbSelect">
<select name="selectPoke">
<option value="">---SELECT---</option>
<?php
$querypoke="SELECT `pokeName`, `pokeID` from `pokemon`";
$db=mysqli_query($db, $querypoke);
while($d=mysqli_fetch_assoc($db)){
echo "<option value='{".$d['pokeID']."}'>".$d['pokeName']."</option>";
}
?>
</select>
</div>
<div id="pokemon1">
<h2>Other</h2>
<table class="tblPokedex">
<tr>
<th colspan="2">
<?php
$selectedPoke = isset($_POST['selectPoke']) ? $_POST['selectPoke'] : '';
echo $selectedPoke;
?>
</th>
</th>
<tr>
<th rowspan="2"></th><th></th>
</tr>
<tr>
<th></th>
</tr>
<tr>
<th></th><th></th>
</tr>
<tr>
<th colspan="2"></th>
</tr>
</table>
</div>
</body>
</html>
The echo $selectedPoke is just for test, to show what value it has. it will be replaced with the path saved inside the Table.
PS: I know that i should protect the webpage from mysql injection using the sanitize, it will be done don't you worry ;)
PSS: To the guy the marked the answer as one of the forums, he could at least tried to understand the problem instead of marking it as the answer when it has nothing to do with my problem, also i've placed the isset and it deleted the error (obviously) but nothing appear (as expected since i "clear" the error).
I've searched this forums for answers but none of them works. Thanks in advance!