Sorry for the trivial question but I'm creating a web application and for various reasons I need to pass a variable from html to PHP. My code is:
HTML
<form action='nameShow.php' method='POST' enctype='multipart/form-data'>
<select name = 'nameU' id='nameU'>
<?php
$sql = mysqli_query($db, "SELECT nome, cognome FROM utenti");
echo ("<option value = 'hi'> all </option>");
while ($row = $sql->fetch_assoc()){
echo "<option value=". $row['name'] .">" . $row['name'] . "" . $row['surname'] . "</option>";
}
?>
</select> <br/>
<div class='centro'>
<input type='submit' class='inputColor centro' value='Conferma' name='submit'>
</div>
</form>
PHP
<?php
$idU = mysqli_real_escape_string($db,$_POST['nameU']);
$_SESSION['idU'] = $idU;
echo $idU;
$id = $_SESSION['idU'];
echo $id;
?>
The problem is that after sending the form in PHP it appears that I haven't sent anything, can anyone tell me why?