我试图从表单中的下拉列表中获取值并将该值打印到屏幕上。从设置为“自身”的表单操作。在 mysql 语句中使用此变量
//load drop downs
$result = mysqli_query($db, "SELECT * FROM actor_id");
//loads actor_name to drop down
print("<select name=\"actor_name\">\n");
while($row = mysqli_fetch_array($result))
{
print ("<option value=" . $row[0] . ">" . $row[1] . "</option>");
$row = mysql_fetch_row($result);
}
print("</select>");
//close DB
mysqli_close($db);
?>
<form method = "post" action="actors.php" >
<br />
<input type="hidden" name="stage" value="1" />
<input type="submit" name="submit" value="Search" >
</form>
//after submit reloads this
if(isset($_POST['actor_name']))
{
$star = $_POST['actor_name'];
print "Star: " . $star;
}//want to use this variable in a mysql statement