title: js change select name based on option selection
body: <p>I have a dynamic drop down menu where options are loaded from database, Now i need to change the  attribute every time different option is selected from the drop down menu.</p>
  
  <p>To achieve this I am trying to use js in my opinion suitable to do the job but unfortunately I find it difficult and cannot come up with a correct solution, actually i dont know how to start it.</p>
  
  <p>Here is my PHP code that dynamicly generates drop down menu: </p>
  
  <pre><code>$opt = '&lt;select id="Forex" name="" style="display: none"&gt;';
              $opt1 = '&lt;option value=""&gt;Select Forex Workshop&lt;/option&gt;';
                  $opt2 = '';
                  while($result = mysqli_fetch_assoc($query)){
                      if($timestamp &lt; $result['endingDate']){
                      $opt2 .= '&lt;option id="'.$result['id'].'" value="'.$result['startingDate'].'"&gt;'.$result['course'].'&lt;/option&gt;';   
                      }
                  }
  
                  $opt3 =  '&lt;/select&gt;';
                  return $opt.$opt1.$opt2.$opt3;
  </code></pre>
  
  <p>Could some one suggest a solution a at least give me a link to a article that covers this problem</p>