title: open new popup window and return value
body: <p>I am trying to open a new popup window, insert values into database, after that return one value to current window. After I open a new popup window and click return, it returns the value but when I click on submit and return it after that, the value doesn't get returned. I think that's because the new window gets refreshed by the submit button. That's why it doesn't return the value.</p>
  
  <p>Main Page</p>
  
  <pre><code>&lt;form&gt;&lt;/form&gt;
  
  &lt;form&gt;
  &lt;input name="maparea" size="2" type="TEXT"&gt;
  &lt;input onclick='targetitem = document.forms[1].maparea; dataitem = window.open("popup.php", "dataitem", "toolbar=no,menubar=no,scrollbars=yes"); dataitem.targetitem = targetitem' value="Get Value" type="button"&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>Popoup window</p>
  
  <pre><code>&lt;script&gt;
     function select_item(item){
        targetitem.value = item;
        top.close();
        return false;
     }
  &lt;/script&gt;
  
  &lt;form  action="" method="post"&gt;
     &lt;input type="submit" name="sub" value="Submit" /&gt;
     &lt;input type="button" name="re" value="Return" onclick='return select_item("3")' /&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>Any solution for that?
  I want to submit what I want first after that return the value</p>