kira423
kira423

Reputation: 427

Using GET method when I already have a ? in my Querystring

This seems like a simple to answer question, but I cannot figure out how to do it, or if it is even possible.

I am building a search bar so users can search offers on a website. It works using the POST method, but it doesn't update the Querystring, and I want users to be able to see what they have searched, so I must use the GET method.

My url is set up as follows:

http://mysitename.com/index.php?rs=offers

The ?rs=offers defines being on the offer page. Without the ?rs= it registers as accessing the index.php file directly, and gives an error. It's like an anti hack thing.

What I am wanting to know is how I can start the GET method after the ?rs=offers so it reads something like this:

http://mysitename.com/index.php?rs=offers&find=whatisearched

right now it looks like this:

http://mysitename.com/index.php?find=whatisearched

Which gives the error I described above.

This is the current form layout as well so you can see if there is something in it that I may have defined wrong.

<form method='get' action='index.php?rs=offers'>
    <table class='offers'>
<tr>
    <th>Search All Offers</th>
</tr>
<tr> 

    <td>

      <input type='text' name='find' maxlength='255' style='width:200px' value='' />

      <input type='submit' value='Search' />

    </td>

  </tr>

</table>
</form>

Upvotes: 2

Views: 80

Answers (1)

Matt
Matt

Reputation: 7040

Try this instead:

<form method='get' action='index.php'>
    <input type='hidden' name='rs' value='offers' />
    .
    .
    .
</form>

Upvotes: 6

Related Questions