我有一个用户有下拉列表的表单。表单有一个get方法,以便输出值用于处理..但问题是我得到所有三个值都无法使用.. < / p>
<form method="get" action="finish.php">
<select name="case" >
<option value="">*Grimsborough Case*</option>
<option value="1" >001</option>
<option value="2" >002</option>
<option value="3" >003</option>
</select>
<select name="case" >
<option value="">*Pacific Bay Case*</option>
<option value="201" >PB01</option>
<option value="202" >PB02</option>
<option value="203" >PB03</option>
</select>
<select name="case" >
<option value="">*World Edition Case*</option>
<option value="301" >WE01</option>
<option value="302" >WE02</option>
<option value="303" >WE03</option>
</select>
这些是我输出的表单,而我选择的是这样......
finish.php?case=&case=&case=302&submit=%3D%3D>+submit+<%3D%3D
我想得到像这样的输出
finish.php?case=302&submit=%3D%3D>+submit+<%3D%3D
请帮助:)
答案 0 :(得分:0)
您需要以不同的方式命名您的选择元素
<form method="get" action="finish.php">
<select name="case1" >
<option value="">*Grimsborough Case*</option>
<option value="1" >001</option>
<option value="2" >002</option>
<option value="3" >003</option>
</select>
<select name="case2" >
<option value="">*Pacific Bay Case*</option>
<option value="201" >PB01</option>
<option value="202" >PB02</option>
<option value="203" >PB03</option>
</select>
<select name="case3" >
<option value="">*World Edition Case*</option>
<option value="301" >WE01</option>
<option value="302" >WE02</option>
<option value="303" >WE03</option>
</select>
从你的php脚本中,你可以这样做:
$case1 = $_GET["case1"];
$case2 = $_GET["case2"];
$case3 = $_GET["case3"];
答案 1 :(得分:0)
如果我理解得对,你想要这样的东西:
<select name="case" >
<optgroup label="Grimsborough Case">
<option value="1" >001</option>
<option value="2" >002</option>
<option value="3" >003</option>
</optgroup>
<optgroup label="Pacific Bay Case">
<option value="201" >PB01</option>
<option value="202" >PB02</option>
<option value="203" >PB03</option>
</optgroup>
<optgroup label="World Edition Case">
<option value="301" >WE01</option>
<option value="302" >WE02</option>
<option value="303" >WE03</option>
</optgroup>
</select>