提交后用锚点重新加载页面

时间:2016-04-14 14:47:31

标签: javascript php forms reload

我在PHP中有一个很大的表单,有几个表,每个表计算一个(价格和数量)的总和,然后在最后计算总数。

<form action="<?php echo $_SERVER['PHP_SELF']; ?>" id="purchase_form">
    <div id="purchase_1">
        <table>
            <input id="price_1">
            <input id="quantity_1">

            <input type="submit" name="calculate" value="Click here to calculate the partial">
        </table>
    </div>
    <div id="purchase_2">
        <table>
            <input id="price_2">
            <input id="quantity_2">

            <input type="submit" name="calculate" value="Click here to calculate the partial">
        </table>
    </div>

    <tr>
        <td id="price_sum"><?php *script* ?></td>
        <td id="quantity_sum"><?php *script* ?></td>
    </tr>
</form>

现在,当我点击提交来计算&#34;部分&#34;时,它同时给出了总数。我知道它不是最先进的形式,但无论如何,只是试图对此视而不见。

我想要的是,当我点击提交按钮时,重新加载页面显示我点击的表单。比如,如果我点击#purchase_1表的提交,我希望页面在#purchase_1表上重新加载,依此类推。

用javascript可以做到吗?

0 个答案:

没有答案
相关问题