0

我有一个下拉列表,用户在其中选择一些值并按 javascript 的排序顺序移动到其他下拉列表。如何在下一页的第二个下拉列表中将所选值获取到 PHP 变量?

<form name="Example" action="next.php" method="post">
<table border="0" cellpadding="3" cellspacing="0">
    <tr>
        <td>
            <select name="Features" size="9" MULTIPLE>
                <option value="2">Row 2</option>
                <option value="4">Row 4</option>
                <option value="5">Row 5</option>
                <option value="6">Row 6</option>
                <option value="7">Row 7</option>
                <option value="8">Row 8</option>
                <option value="9">Row 9</option>
            </select>
        </td>
        <td align="center" valign="middle">
            <input type="Button" value=">>" style="width:100px" onClick="SelectMoveRows(document.Example.Features,document.Example.FeatureCodes)">
            <br>
            <input type="Button" value="<<" style="width:100px" onClick="SelectMoveRows(document.Example.FeatureCodes,document.Example.Features)"><br>

            <input type="Button" value=">>>>" style="width:100px" onClick="selectAll(document.Example.Features);SelectMoveRows(document.Example.Features,document.Example.FeatureCodes)"><br>

            <input type="Button" value="<<<<" style="width:100px" onClick="selectAll(document.Example.FeatureCodes);SelectMoveRows(document.Example.FeatureCodes,document.Example.Features)">
        </td>
        <td>
            <select name="FeatureCodes[]" id="FeatureCodes" size="9" MULTIPLE>
                <option value="1">Row 1</option>
                <option value="3">Row 3</option>
            </select>
        </td>
    </tr>
    <tr>
    <td><input type="submit" value="submit" id="submit" name="submit"></td>
    </tr>

</table>

提前致谢!!

4

1 回答 1

1

第二个表单字段中选定元素的值应位于:

$_POST['FeatureCodes'][0];

如果页面上只有一个FeatureCodes表单,则可以[]从 HTML 中删除并使用$_POST['FeatureCodes'];

于 2013-04-21T08:21:49.050 回答