用输入get发送值?

时间:2010-08-27 17:58:54

标签: php html xhtml get

<a href="companies.php?id='. $_GET['id'] .'&offset='. $next_offset .'"><input id="button" type="button" value="More"/>

我想以某种方式发送&amp; offset = avalue但使用输入按钮。没有身份证。

如何使用表单动作获取similer事件? 喜欢(警告史诗失败)我应该添加一个隐藏的输入或什么?

    echo '<form action="welcome.php" method="get">';
    echo '<a href="companies.php?id='. $_GET['id'] .'&offset='. $next_offset .'"><input id="button" type="button" value="More"/></a>';      
    echo '</form>';

如果你们不理解,请发表评论!

好吧,不知怎的,我已经设法让它发挥作用

    echo '<form action="companies.php?id='. $_GET['id'].'" method="get">';
    echo '<input type="hidden" name="offset" value="'.$next_offset.'">';
    echo '<input id="button" type="submit" value="More"/></a>';     
    echo '</form>';

但仍有错误http://local.host/networks/companies.php?offset=5,我的获取ID在哪里? 顺便说一句,我还在检查它,谢谢你们:)

和啊哈!它的工作原理

    // MORE PLUGIN
    echo '<form action="companies.php" method="get">';
    echo '<input type="hidden" name="id" value="'.$_GET['id'].'">';
    echo '<input type="hidden" name="offset" value="'.$next_offset.'">';
    echo '<input id="button" type="submit" value="More"/></a>';     
    echo '</form>';
    // END PLUGIN

2 个答案:

答案 0 :(得分:2)

首先,您可以将参数放在表单的action属性中,就像使用链接和href一样。

更可读的选项是隐藏的输入元素:<input type="hidden" name="offset" value="your_value">

这是你问的吗?

答案 1 :(得分:2)

<? echo '<input type=button onclick=\'window.location="companies.php?offset='. $next_offset .'"\'>';?>