我有一个带有多个复选框的表单,这些复选框是从 MySQL 表中的唯一值生成的:
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<?php
$query5="SELECT distinct from_user from tracks WHERE uploaded_page='$this_path_short' ORDER BY from_user";
$result5=mysql_query($query5) or die(mysql_error());
while ($row = mysql_fetch_array($result5)) {
$from_user = $row['from_user'];
echo "<input type=\"checkbox\" name=\"from_user[]\" value=\"AND ".$from_user."\" checked=\"checked\">".$from_user."<br>";
}
?>
<input type="submit" name="submit" value="filter"><br>
然后我想将“from_user”值的数组传递给页面上的另一个 MySQL 查询。我可以得到这样的值:
$names=implode(" ", $_POST['from_user']);
但我不确定如何在以下 MySQL 查询中包含此数组:
$query1="SELECT * FROM tracks WHERE from_user IN **array goes here**)";