我的目标是获得两个下拉值,然后将其传递给action
,然后将其传递到$_POST
到下一个.php
页面。简而言之,我想使用action
菜单选择drop-down
php页面。
我在这里做错了,无论我从page
下拉菜单中选择什么,它总是默认选择page1.php
<html>
<body>
<select name='page'>
<option value='page1.php'>page1</option>
<option value='page2.php'>page2</option>
</select>
<form name="page" method="post" action="<?php echo $_POST['page']; ?>">
<?php
// DB connection info:
include 'db_connection.php';
$sql = "SHOW tables";
$result = mysql_query($sql);
echo "<select name='param1'>";
while ($row = mysql_fetch_array($result)) {
echo "<option value='" . $row['Tables_in_radius'] . "'>" . $row['Tables_in_radius'] . "</option>";
}
echo "</select>";
?>
<input type="submit" value="send">
</form>
<?php
if(isset($_POST['param1'])){
}
?>
</body>
</html>
答案 0 :(得分:0)
1)将下拉放在表格内。
2)if(isset($ _ POST [&#39; param1&#39;]))&lt; - 什么是param1? 将其更改为:$ _POST [&#39; page&#39;]