In reverse order to fill HTML form from GET parameters?

Submit the form with the GET method, I want when the page loads, the form was filled with the sent parameters earlier, taking them from the URL.

Specifically, it advanced search in the catalog, you need something when sending the request form kept the contents on the next page, so the user could see the results of what the query issued to him.

Is there a ready-made solution and then have to fill in the script form?
September 19th 19 at 12:32
4 answers
September 19th 19 at 12:34
Solution
On the next page? That is, the page is reloaded? What is that jquery you have... maybe still we are talking about PHP?

In the General case — it is not necessary to take anything from the URL. You already sent a GET request, and received in return some data which brought on next page.

Now take your get, take out the queries you want and insert it back into shape. If you do PHP, then do as stated in the first comments, just in case to check:

<input type="text" name="name" value="'.($_GET['name'] ? $_GET['name'] : ").'">


If you have a JS/JQ, meaning exactly the same, only rewrite for themselves.
Write in Ruby, more specifically for Sinatra, gut-variable params and push the values into the form on the server side is not easy for me.

Here's the RUB. Use JQuery Mobile. I still have not figured out how can I make a Hat and a Basement (header & footer) the same for all pages (normal method without tricks), and not to throw at the AJAX same, because change only page content, the footer and the basement is not changing anywhere. And nowhere is changing slip socket with the advanced search form. How to make a global socket that works on all pages I figured it out.

So I did the hard temporarily and completely disabled for the JQueryMobile AJAX. Temporarily. In the future I certainly will handle it and return the AJAX transitions between pages.

Perhaps commentators are right, including you, will fill out the form on the server side. - Cornell.Da commented on September 19th 19 at 12:37
September 19th 19 at 12:36
all variables that are present in the address bar, the page receives a total variable $_GET.
For example, if the URL is ?question=123&answer=456, then feel free to write inputo
<input type="text" name="question" value="<?=$_GET['question'];?>">
<input type="text" name="answer" value="<?=$_GET['answer'];?>">
The author is in the js and jquery tags - Cornell.Da commented on September 19th 19 at 12:39
: why test? if php does not find this variable, it just won't stick. well, if we talk about aesthetics, then ......... well, you know...
who knows what is written in the tags. tags are not requirements. this film, which will be the question. in this case, js and jquery is not needed. when the form is submitted the page is reloaded (the author himself writes about it), and if the page is loaded with GET parameters in the url-e, it requires only primitive php. - Elisa60 commented on September 19th 19 at 12:42
September 19th 19 at 12:38
How to put get parameters into an array, written, for example, here, you can probably find other ways or plugins:
stackoverflow.com/questions/901115/how-can-i-get-q...

It is logical that the name of the GET parameter should match any attribute of form elements.
Having an array of GET parameters you can go through all the form elements and look for the values of the elements of the array with keys corresponding to the attribute of the form element.
September 19th 19 at 12:40
So it's some type of routing on rastarivanie URL? Then see the variable S_Server disassemble it and shove in the form fields.

Find more questions by tags jQueryHTMLJavaScript