dqef7931 2016-11-29 09:10
浏览 51
已采纳

表单添加现有的变量

I'm creating a simple form which when filled out, it will add the variable and form content to the end of https://www.example.com/clients/cart.php?a=add&pid=91

So the aim is to have a form with variable name sld and then adds this to the end of the above URL, so that it becomes https://www.example.com/clients/cart.php?a=add&pid=91&sld=CONTENT

However, the form (code below) ignores the existing variables and simply defaults to https://www.example.com/clients/cart.php (eg. cart.php?sld=CONTENT.

Is there a way to keep the existing variables and submit the form content at the end of the provided URL?

<form action="https://www.example.com/clients/cart.php?a=add&pid=91" method="get">
<input type="text" name="sld" placeholder="google">.
<input type="text" name="tld" placeholder="com">
<input type="submit" value="submit">
</form>
  • 写回答

1条回答 默认 最新

  • dsf6281 2016-11-29 09:13
    关注

    You can add two hidden fields with the value:

    <form action="https://www.example.com/clients/cart.php" method="get">
        <input type="text" name="sld" placeholder="google">.
        <input type="text" name="tld" placeholder="com">
        <input type="submit" value="submit">
        <input type="hidden" name="a" value="<?php echo $_GET['a']; ?>">
        <input type="hidden" name="pid" value="<?php echo $_GET['pid']; ?>">
    </form>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料