我是PHP的新手,我有一个下拉列表,其中包含多个地址值,我想将所选值插入到表人员中,在我的代码中我只获得了第一个值:state但是我不能'得到其余的值。我应该做些什么来使它工作?她是我的档案(test3.php):
<form action="test3.php" method="GET">
state :<select name="states">
<option value="state1">state1</option>
<option value="state2">state2</option>
<option value="state3">state3</option>
<option value="state4">state4</option>
</select><br>
City :<select name="cities">
<option value="city1">city1</option>
<option value="city2">city2</option>
<option value="city3">city3</option>
<option value="city4">city4</option>
</select><br>
zipcode :<select name="zipcodes">
<option value="zipcode1">zipcode1</option>
<option value="zipcode2">zipcode2</option>
<option value="zipcode3">zipcode3</option>
<option value="zipcode4">zipcode4</option>
</select><br>
Name :<select name="names">
<option value="name1">name1</option>
<option value="name2">name2</option>
<option value="name3">name3</option>
<option value="name4">name4</option>
</select><br>
<input type="submit" name="submit" value="Insert">
</form>
<?php
if(isset($_GET['states']))
{
$name=$_GET['states'];
$c=mysql_connect("localhost","user","");
mysql_select_db("db");
$ins=mysql_query("INSERT INTO `persons`
(state)
VALUES ('$name')",$c);
}
?>