I'm quite new with PHP and javascript, so apologize me if this is an easy question.I have a form with a dropdown box and a GO button, used to select documents (from the dropdown box) and navigate to them (GO button). What I would like to do is to retrieve the document URL from the database when the dropdown item is selected and pass it to the button, so when clicked it sends the user to the document. The MySQL query looks like this:

SELECT `Bruel_URL` FROM `mpctz_rsform_bruels` WHERE `Bruel_ID` = GO.value

So the questions are:

  1. How do I get the value from the Bruel_ID and pass it to the MySQL query (I've represented it as GO.value in the query above)?
  2. How do I retrieve and store the Bruel_URL?
  3. How can I write a javascript function that sends the user to the Bruel_URL?

Thanks for your help!

I'm not sure I understand your problem completely but I'll try to help.
Firstly, as you're using PHP you can make the GO button a submit button. When a value is selected in the drop down you don't need to do anything else until GO is clicked. Then the selected drop down value can be passed back as part of the form data. You then do the SQL query, get the URL and redirect to the correct location.
If you want to do away with the page reload and redirection you can look into AJAX. In this case, you'll do an AJAX request with the selected drop down value as a parameter, returning the URL. You can then edit the button to link to the correct URL.
You'll need to add a server side component to handle the AJAX query for this method to work.
Option 1 is probably much easier to implement but option 2 would be faster and more efficient.