penpen
penpen

Reputation: 935

Submitting search form but also having query string in PHP (and JS)

I have a page with a search form (with just one field) submitting to another page to perform a search and show results.

Often on other sites whenever I search for something in a form I see my search terms in a query string which is handy for bookmarking/sharing a link with someone.

eg-

 http://grooveshark.com/#/search?q=name+of+band

How is the query string made from a form submission?

Upvotes: 0

Views: 152

Answers (2)

aziz punjani
aziz punjani

Reputation: 25776

The query string is constructed by the user agent by processing the form data. You can read more about it here.

Upvotes: 1

Bradley Staples
Bradley Staples

Reputation: 367

Change your form to use the get method instead of post, or add the attribute below if it's not there already.

<form name="test" action="some/page.php" method="get">

Upvotes: 3

Related Questions