tags:

views:

62

answers:

4

I have a page I am constructing and I need to pass in the values of the option dropdowns to the next page. The problem is that these dropdowns are not in a form.

http://posnation.com/test/pre_config/pre_config_step_2.html

Basically what i need to pass to the next page is that when i click "Proceed To Next Step" I need to pass the value of the type of field like "restaurant" and the number of stations "2" if the user selects restaurant and 2.

+1  A: 

Use a query string.

http://posnation.com/test/pre_config/pre_config_step_2.html?restaurant=The+Eatery&stations=2

In other words, pass them as part of the URL when calling the next page. The next page will be responsible for reading the query string and extracting the values out.

http://en.wikipedia.org/wiki/Query_string

I do not know what you are using to code in so I cannot be detailed regarding the mechanics of constructing the URL or parsing out the values from the query string on the receiving page.

Here is an article on doing it using JavaScript:

http://javascript.about.com/library/blqs.htm

Justin
+3  A: 

HTML:

<a id="proceed" href="foo.html">Proceed!</a>

JS:

$('#proceed').click(function() {
    location.href = this.href +'?someVal='+ escape($('#my_select').val());
    return false;
});

Working example that executes a formless google search: http://jsfiddle.net/CKcbU/

You basically just add what you want to the query string with javascript.

But really, if at all possible, you should use a form with method="get" which pretty much does this for you without any JavaScript at all.

Squeegy
A: 

You can use JavaScript for the same. Assign a onclick event with button of proceed and call a function. In this function use:

windows.location=url?rest=valuerest&opt=valueopt
Logan
Here url is the location u want to redirect to, valuerest is the rest value u want to pass and value opt is 2(in ur case).
Logan
A: 

I am not sure what you are working with, but with almost any framework that I know of you can pass a parameter as part of the url.

These would work fine.

http://posnation.com/test/pre_config/step_2
http://posnation.com/test/pre_config/step_3

Then, just grab the parameter and react accordingly.

Scott Radcliff