Passing Parameters Via Query Strings
3. Read Querystrings
Join the Discussion
More of this Feature
The only other thing that we need to do is to initialize entries in the array for the fields that we want the page to process and to actually call the azbove function to retrieve the values. If we are adding the code to the top of the purchases page then we are expecting code and desc fields to be passed from the previous page. Of course the purchases page may be reached without values for these fields being selected so we need to assign default values to the fields before we call the function to load them with the passed values. Here is the code that does this for us. This code also goes into the head section of our page.
qsParm['desc'] = null;
qs();
The values passed from the previous page are now accessible to any Javascript code in the current page by referencing the appropriate qsParm array entries. Of course you may want to check if the fields are still set to null (meaning that no value was passed for that field). So to display the product that was selected on the previous page we can use the following code in the body section of our page.
document.write('You selected' + qsParm['code']

