我想从表单中获取信息并将其放入表格中,并将其放入正确的表格中

时间:2017-06-01 19:29:18

标签: php html forms html-table

我是HTML的新手,我目前有一个学校的HTML项目。问题是我需要从表单中获取信息到一个表(在同一页面上,没有服务器,所以没有重新加载),当然我不知道任何PHP(这是我被告知是需要的,以便做这项工作。)

这是我表单的代码:

<form id="dispatch" name="dispatch" method="post" action="form.pxp">
    <select name="State" id="State">
        <option value=" Alabama"> Alabama</option>
        <option value=" Alaska"> Alaska</option>
        <option value=" Arizona"> Arizona</option>
        <option value=" Arkansas"> Arkansas</option>
        <option value=" California"> California</option>
        <option value=" Colorado"> Colorado</option>
        <option value=" Connecticut"> Connecticut</option>
        <option value=" Delaware"> Delaware</option>
        <option value=" Florida"> Florida</option>
        <option value=" Georgia"> Georgia</option>
        <option value=" Hawaii"> Hawaii</option>
        <option value=" Idaho"> Idaho</option>
        <option value=" Illinois"> Illinois</option>
        <option value=" Indiana"> Indiana</option>
        <option value=" Iowa"> Iowa</option>
        <option value=" Kansas"> Kansas</option>
        <option value=" Kentucky"> Kentucky</option>
        <option value=" Louisiana"> Louisiana</option>
        <option value=" Maine"> Maine</option>
        <option value=" Maryland"> Maryland</option>
        <option value=" Massachusetts"> Massachusetts</option>
        <option value=" Michigan"> Michigan</option>
        <option value=" Minnesota"> Minnesota</option>
        <option value=" Mississippi"> Mississippi</option>
        <option value=" Missouri"> Missouri</option>
        <option value=" Montana"> Montana</option>
        <option value=" Nebraska"> Nebraska</option>
        <option value=" Nevada"> Nevada</option>
        <option value=" New Hampshire"> New Hampshire</option>
        <option value=" New Jersey"> New Jersey</option>
        <option value=" New Mexico"> New Mexico</option>
        <option value=" New York"> New York</option>
        <option value=" North Carolina"> North Carolina</option>
        <option value="  North Dakota">  North Dakota</option>
        <option value=" Ohio"> Ohio</option>
        <option value=" Oklahoma"> Oklahoma</option>
        <option value=" Oregon"> Oregon</option>
        <option value=" Pennsylvania"> Pennsylvania</option>
        <option value=" Rhode Island"> Rhode Island</option>
        <option value=" South Carolina"> South Carolina</option>
        <option value=" South Dakota"> South Dakota</option>
        <option value=" Tennessee"> Tennessee</option>
        <option value=" Texas"> Texas</option>
        <option value=" Utah"> Utah</option>
        <option value=" Vermont"> Vermont</option>
        <option value=" Virginia"> Virginia</option>
        <option value=" Washington"> Washington</option>
        <option value=" West Virginia"> West Virginia</option>
        <option value=" Wisconsin"> Wisconsin</option>
        <option value=" Wyoming"> Wyoming</option>
    </select>
    Creature: <input type="text" name="FirstName"><br>
    <input type="submit" value="Report">
</form>

以下是其中一个表的代码(每个状态一个):

    <table cellspacing="0" id="california" class="table" for="path7">
    <tr>
        <th class="infoheader">California</th>
    </tr>
    <tr>
        <th id="th1">Creature</th>
        <th id="th2">Quantity</th>
    </tr>
    <tr>
        <td id="td1">Wolf</td>
        <td id="td2">5</td>
    </tr>
    <tr>
        <td id="td1">Boar</td>
        <td id="td2">3</td>
    </tr>
    <tr>
        <td id="td1">Elk</td>
        <td id="td2">7</td>
    </tr>
</table>

所以我想从表单中获取信息并将其放入正确的表(状态)。

0 个答案:

没有答案