2

I want an easy way to store the number selected from the drop down list in a variable. How can I achieve this ? The drop down list is dynamic.

thanks

$results = $handle->query("SELECT * FROM id
 WHERE test  = '".$pull ."';");

echo "<html>";
echo "<body>";
echo "<select name='id'>";
   while($table = $results->fetchArray()){
      $tab= $tabe['ic'] -1;
      $b = "1" . $table_ ;
      echo '<option value="'.$tab.'">'.$tab.'</option>';
   }
echo "</select>";
echo "</body>";
echo "</html>";
?>
VHDLprog
  • 57
  • 3

1 Answers1

2

You can get the selected value as following.

console.log($("select").val());
Star_Man
  • 1,091
  • 1
  • 13
  • 30
  • How does that work ? Like where do I put this in my current code. I am pretty new to all this. – VHDLprog Feb 16 '17 at 18:08
  • @VHDLprog If you control this value, my answer is located in – Star_Man Feb 16 '17 at 18:17