I have a form which contains a few drop down lists.The contents of the dropdown lists are dependent on each other and are populated via php scripts which are called each time a selection is made or changed by the user.

When the view results button is clicked in the form I need the user to be directed to a specific page based on the selections they have made.

The url of the page they need to be directed to is really based on what has been chosen in the first dropdown. The subsequent dropdowns form variables that I need to be sent to the page so that the data the user sees on that page is relevant.

ie if the user has chosen bikes then a specific manufacturer then a specific price range the page they will be sent to will be the bike.php page with all the manufacturer specific bikes in their chosen price range visible. Can anyone tell me the best way to go about doing this please?

I had thought about using the php header script along with an if statement but how do I then go about getting the variables sent to the page to be recognised?

Would I be better looking at the window.location in js to do this?

Any help and advice would be greatly appreciated on this. I can post the code for the form if that makes any difference.

if the user has chosen bikes then a specific manufacturer then a specific price range the page they will be sent to will be the bike.php page with all the manufacturer specific bikes in their chosen price range visible. Can anyone tell me the best way to go about doing this please?

There is a PHP server variable called QUERY_STRING that you can use when redirecting the page.

Thanks for the reply Paul but I don't understand how to use what you've suggested. The form currently has 3 dropdown boxes. The first is populated with the options that determine the url the user will be directed to when they click the form button.

The second is a list of makes which is populated once the user makes a selection from the first drop down.

The third is populated based on the selection in the second select.

Each time a selection is made the form also has a results box which updates with the number of results found in the db matching the users choices in the form.

How can I get the user to be sent to the correct page when the form button is clicked?I will also need to send the variables so that the correct results are shown on this final page.

The code I was trying to use is below. Can someone please tell me why the following code is not working or how to implement what Paul has suggested?

If you want to do it from javascript, you can set the form.action attribute to the page you want the form to be submitted to. That way, the submit event for the form will be to the different page that you set in the action property.