Form Search Box Question

The above url is an example... Lets say the above URL returns a form with seach box in it and search button.

How do I get that form to post to the above url with the above parameters?

I really never understood how form posting getting or whatever works, it was very confusing lol.

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

callrsCommented:     Passing Data to Another Page     Passing data from one form to another   How Do I use JavaScript to Pass Values from one Field, Frame or Window to Another?

When form is submitted via the submit button or hitting ENTER (if there's a submit button), the browser takes the form data, formats it automatically, and appends it to the url contained in the action attribute

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Try this simple Google search demo. Select, copy, paste into notepad, save & open in browser:

<!-- Submit via link and submit button     -->
<form name="magic" target=_self method="GET" action="">
<input type=submit name="sendme" value="">
<input type=text name=q size=31 maxlength=2048 value="key" title="Search">

<a href="#" onclick="document.magic.action='';document.magic.submit(); return false;">
HepenAuthor Commented:
How do I pass the existing parameters to the page that gets posted?


Learn SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

Here's a basic explanation:  when "jrs.aspx?test=50&scr=1024x768&keyw=cars&" gets called, jrs.aspx will have statements in there that will do stuff based on the parameters, like maybe:

if test is greater or equal to 50, tell the user that they've reached their limit of tests, and since "scr" = 1024x768, show the test results in a page optimzed to that screen resolution.

You could also use javascript to parse the url and make choices based on that.  But javascript is client-side, whereas my prior example gets executed on the server and does it's parsing before the page actually makes it to the client.
HepenAuthor Commented:
TedInAK that I understand.

Lets say jrs.aspx has a form on it and I want to use the existing information from test, scr, keyw & url.  How can I use these existing parameters? In this case 508,1024x768, cars & .. how can I save that to use it again on another form post
If by save you mean to populate the form fields with that data, best way would be to do it server-side using's built-in tools.  Is that what you mean?
Hi Hepen,

I got your question.
Hope following code should answer you.
var querystring="";
//This is to get the parameters supplied in the URL
function run(){
      var url=location.href;
      var urlparts="";
//Composing the URL to do the form submit
function formPost(){
      document.frm.action="<<actual URL(may be self url)>>"+querystring;
<body onload="run();">
<form name="frm" method="post">
<input type="text" name="searchstr" value="form post"><br>
<input type="button" value="Search" onclick="formPost();">

What actually I am doing here is that reading the above parameters in URL and saving them in a variable.
When I am clicking on the search button to do post, I am composing the action of the Form to append with above parameters.
Hope this point should be clear to you.

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.