title: How to show my selected value of dropdownlist in textbox
body: <p>I have a code which is used to populate the words from text file to listbox. If i select any value from listbox then it display a selected word within the text box (within the form - to post the value to another script)</p>
  
  <p><strong>javascript code:</strong></p>
  
  <pre><code>&lt;script&gt;
    function getSelectedValue(theValue){
      document.getElementById('pasteTheValue').innerHTML=theValue;
    }
  &lt;/script&gt;
  </code></pre>
  
  <p><strong>php code:</strong>
      
  
  <pre><code>//open the file
  $read_your_file = @fopen($your_file, "r") or die ("Couldn't Access $your_file");
  
  //create a variable to hold the contents of the file
  $contents_your_file = fread($read_your_file, filesize($your_file));
  
  //array of file contents
  $your_array = explode("\n",$contents_your_file);
  
  //close the file
  fclose($read_your_file);
  
  //counts the number elements in the property_categories array
  $num_elmnts_array = count($your_array) ;
  
  //elements in the drop down list
  //$drop_elmnts = 0;
  
  //begin creating your dropdown menu...
  
  $your_menu = "&lt;select name=\"list\" onchange=\"getSelectedValue(this.value)\"&gt;";  
  //For loop to begin
  for($counter = 0; $counter &lt; $num_elmnts_array; $counter++){
  $your_menu .= "&lt;option value=\"$your_array[$counter]\"&gt;$your_array[$counter]        &lt;/option&gt;";
  //$counter++;
  }
  //end select menu
  $your_menu .= "&lt;/select&gt;";
  ?&gt;
  
  &lt;p&gt;&lt;b&gt;&lt;?php echo "$your_menu"; ?&gt;&lt;/b&gt;&lt;br&gt;
  &lt;p id="pasteTheValue"&gt;&lt;/p&gt;
  </code></pre>
  
  <p>This works fine. This display a selected word as usual normal text within the page. But i want to show this (or get the value) within the text box. Please help me to solve this.</p>