这是我的代码
<html>
<title></title>
<head></head>
<body>
<div>
<form method="post" action="file_display1.php">
<table>
<tr>
<td>
<label><h4>forward to</h4></label>
</td>
<td>
<select name="section" id="section" class="select" onsubmit="validate();" required=" " autofocus/>
<option selected="selected" value="">---------- Select ----------</option>
<option value="KSCCF LTD">KSCCF LTD </option>
<option value="ADMINISTRATION SECTION">ADMINISTRATION SECTION </option>
<option value="PURCHASE">PURCHASE SECTION</option>
<option value="BEVARAGES">BEVARAGES SECTION</option>
<option value="IT">IT SECTION</option>
<option value="LEGAL">LEGAL SECTION</option>
<option value="ACCOUNTS">ACCOUNTS SECTION</option>
<option value="AGREEMENT">AGREEMENT SECTION</option>
<option value="MEDICAL">MEDICAL SECTION</option>
</select>
</td>
</tr>
</table>
<?php
mysql_connect("localhost","root","ConcentricLions@336");
mysql_select_db("demo");
if(isset($_POST['formSubmit']))
{
$to_sectionid=$_POST['section'];
echo $to_sectionid;
}
?>
</body>
</html>
在此变量$ to_sectionid不接受下拉到该变量的值。
请帮助
答案 0 :(得分:0)
我假设在您的原始代码中您有一个提交按钮,其值为formSubmit。您的问题可能是将页面重定向到另一个页面filedisplay.php,并且该页面中不存在if ... echo命令。尝试action =“”(表示重定向到同一页面)或将您的php命令放入filedisplay.php