Hi,
I am using this code in my form to create a drop down menu. (the list of options loads corrects from my sql database). Once the user hits submit, I should be able to retrieve the value selected with $_POST['field'].
<form action="page2.php" method="post" name="form" id="form">
<?php
$query = sprintf("SELECT domaine FROM `domainema` WHERE userid='%s' ", $userid);
$result=mysql_query($query);
echo "<select name=domaine value=''>Domain </option>";
while($nt=mysql_fetch_array($result)){
echo "<option value=$nt[id]>$nt[domaine]</option>";
}
echo "</select>";
?>
...
On the second page, I use this code:
$domaine = strip_tags(substr($_POST['domaine'],0,32));
echo "You selected $domaine";
But I get nothing a blank value, what am I doing wrong?
Thanks!