PHP Populate Text box from Select - Array fields
<p>I need to populate the relevant text box with the results of a Select drop down.</p>

<p>My Javascript so far is </p>

<pre><code>&lt;script language="JavaScript"&gt;
var mytextbox = document.getElementById('error');
var mydropdown = document.getElementById('errormsg_id');

mydropdown.onchange = function(){
     mytextbox.value = this.value;
}
&lt;/script&gt;
</code></pre>

<p>My select box and text boxes are built as arrays from a query so there is nultiple of them.
I need to be able to populate the corresponding text box with the results from the Select next to it. </p>

<p>Any ideas?</p>

<p>Thanks</p>

<pre><code>    &lt;td width="1%"&gt;

    &lt;select style="width:100%" name="errormsg_id[]"  id="errormsg_id[]"&gt;

    &lt;?php do { ?&gt; 

    &lt;option value="&lt;?php echo  $row_rserrormsg['errormsg_id']?&gt;"
    &lt;?php if ($row_rsdates['errormsg_id'] == $row_rserrormsg['errormsg_id'])                 {              echo("selected='selected'"); } ; ?&gt; &gt;
&lt;?php echo $row_rserrormsg['error_message']?&gt;&lt;/option&gt;

&lt;?php } while ($row_rserrormsg = mysql_fetch_assoc($rserrormsg)); ?&gt;

&lt;?php  mysql_data_seek($rserrormsg, 0);
$row_rserrormsg = mysql_fetch_assoc($rserrormsg);?&gt;
&lt;/select&gt;
&lt;/td&gt;  

&lt;TD  align="center" class="adminuser"&gt;
&lt;input style="width:96%;text-align:left;"  autocomplete="on"  title="Enter Error    Message" type="text" name="error[]" id="error[]" value="&lt;?php echo $row_rsdates['error_message']; ?&gt;" maxlength="100"/&gt; 
&lt;/TD&gt;
</code></pre>
