开发者

Multiple GET arguments

I've been 开发者_JAVA技巧working with PHP lately, and I came across something I couldn't solve.

So basically, I have a form:

<form method="get">
    <fieldset class="display-options" style="float: left">
    Search by name or ip:
        <input type="text" name="key" value="" />&nbsp;
        <input type="submit" class="button2" value="Search" />
    </fieldset>
</form>

The problem is, I currently already have a argument:

http://example.com/logs.php?type=admin&page=1

How would i pass the given form argument with the already existing arguments? Like so:

http://example.com/logs.php?type=admin&page=1&key=name

Thanks in advance, AJ.


<snip />

EDIT: hidden fields is your best and most reliable option.

<input type="hidden" name="var1" value="<?php echo $_GET['var1']; ?>" />

Place a couple of those in your <form> element and they'll get passed along with the other data.

You shouldn't need an isset() but it might be a good idea.


if (isset($_GET['key'])) {
    $_print_r($_GET);
}

This should have the query string and the fields.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜