dynamic drop down - user selection used for table creation. Is it possible?
<p>ok I've gotten this far with your wonderful help, just trying to work out where I'm going wrong still?</p>

<pre><code>    &lt;script&gt;
 function disp_text()
   {
   var w = document.myform.mylist.selectedIndex;
   var selected_text = document.myform.mylist.options[w].text;
   location.href="By_regions_report2.php?selected_text=" + selected_text; //loading a seperate php page to catch result
   alert(selected_text);
   }
   &lt;/script&gt;
&lt;?php

$dropdown_sql="SELECT DISTINCT `2010 RSG Code` AS codes FROM locations";
$dropdown_result=mysql_query($dropdown_sql);

$options="";

while ($row=mysql_fetch_array($dropdown_result)) {
    $codes=$row["codes"];
   $options.="&lt;OPTION VALUE=\"codes\"&gt;$codes&lt;/option&gt;";

     }

?&gt;
&lt;form NAME="myform"&gt;
&lt;SELECT NAME="mylist" onchange="disp_text()"&gt;
&lt;OPTION VALUE=0&gt;Select a region
    &lt;?php echo $options ?&gt;
    &lt;/SELECT&gt;
    &lt;/form&gt;
</code></pre>

<p>this is the second .php file:</p>

<pre><code>&lt;?php

$selectedCode = $_GET[selected_text];
?&gt;
</code></pre>

<p>getting error Use of undefined constant selected_text - assumed 'selected_text'  when the onchange() function is invoked</p>

<p>edit:
is there a way to reload the original page automatically with the new variables in it?</p>
