title: How to refresh drop-down list on parent page
body: <p>I have a drop-down list on a PHP/HTML page. I have a button beside it which when clicked opens a pop-up window via which I can add more items to the drop down list (it gets stored in a mysql table). When I close the pop-up window it should trigger an event which in turn should refresh the drop-down list on parent page.</p>
  
  <p>How to do it? Thanks!</p>
  
  <p>Edit: There are 2 drop-down lists on the page. Options list in 2nd DDL depend on the selection made in 1st DDL. Beside 2nd DDL, there is an button which opens a pop-up window. Using the PPW one can add options to 2nd DDL (stored in mysql table).</p>
  
  <p>Now the pop-up window option is working perfectly, data is getting saved in the table. Right now only option for me is to refresh the page. I want an event to occur when close button on PPW is clicked. This event should refresh the 1st DDL in such a way that option selected previously remains selected. Can it also do this: data added by me should be selected in 2nd DDL.</p>
  
  <p><strong>Code</strong></p>
  
  <p>1st DDL</p>
  
  <pre><code>&lt;td&gt;State Name&lt;/td&gt; 
  &lt;td&gt;&lt;select id="a" name="a" onchange="ajax(this.value);"&gt;
  &lt;option value=""&gt;Select State Name&lt;/option&gt;
  &lt;?php
  $sql = "SELECT * FROM State";
  $abc = mysql_query($sql);   
  while($row = mysql_fetch_array($abc)){ 
  echo "&lt;option value=\"".$row['scode']."\"&gt;".$row['State']."&lt;/option&gt;\n";}
  ?&gt;
  &lt;/select&gt;&lt;/td&gt;
  </code></pre>
  
  <p>2nd DDL</p>
  
  <pre><code>&lt;td&gt;School Name&lt;/td&gt;
  &lt;td&gt;&lt;select name="schname"&gt;
  &lt;option value=""&gt;Select School Name&lt;/option&gt;&lt;/select&gt;
  &lt;A href="addsch.php?State=&lt;?php echo $state?&gt;&amp;scode=&lt;?php echo $scode?&gt;"Target='_blank'&gt;Add New School Name&lt;/a&gt;&lt;/td&gt;
  </code></pre>
  
  <p>The ajax function named 'ab' does the refresh when 1st DDL is selected.</p>
  
  <p>addsch.php opens a form in a pop-up window with a submit button which saves the form data to mysql table. </p>
  
  <p>Example: I select 'State1' from 1st DDL, school names in for 'State1' are displayed in 2nd DDL. I want to add one school name (say 'State2' to 2nd DDL, so I use the add option. After saving the form data, I want 1st DDL to refresh in such a way that 'State1' remains there and 2nd DDL shows 'State2'. Otherwise atleast 1st DDL is refreshed then the user can select 'State2' from 2nd DDL himself.</p>
  
  <p>How to do this?</p>