0

I wanted to make a search form with GET but there seems to be a problem. The page you are looking at has other GET values too but it seems that the GET method clears the URL from variabels en goes like "?q=SEARCH" instead of "?p=Test&u=Bart&q=SEARCH".

This is the form code I'm using:

<form method="GET" action="test.php?p=glistentries&maingroup=<? echo $MainGroupID ?>&subgroup=<? echo $SubGroupID ?>">
                       <input type="text" class="form-control" id="focusedinput" value="<? echo $_GET['q']; ?>"
                       name="q" autocomplete="off" class="col-sm-4 control-label" placeholder="Search...">
                       <input type="submit" style="position: absolute; left: -9999px; width: 1px; height: 1px;"/>
                       </form>

Solved It Thanks guys, forgot I can simply do this with hidden fields

1
  • Look at &maingroup=<? echo.....You need to do &maingroup<?php echo... Commented Apr 24, 2014 at 21:25

2 Answers 2

1

Add the additional GET vars as hidden inputs:

<input type="hidden" name="p" value="Test">
Sign up to request clarification or add additional context in comments.

Comments

0

Use input type hidden :

<form method="GET" action="test.php">
    <input type="text" class="form-control" id="focusedinput" value="<? echo $_GET['q']; ?>" name="q" autocomplete="off" class="col-sm-4 control-label" placeholder="Search...">
    <input type="submit" style="position: absolute; left: -9999px; width: 1px; height: 1px;"/>
    <input type="hidden" name="p" value="glistentries" />
    <input type="hidden" name="maingroup" value="<? echo $MainGroupID ?>" />
    <input type="hidden" name="subgroup" value="<? echo $SubGroupID ?>" />
</form>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.