title: Grab Value from Javascript popup - use as php post value
body: <p>First off, if there is a completely better way of doing this? let me know...  This way seems kind of "hackish".  Here is what I am trying to do:  As you see in the below <code>input</code>, I have a text field that I simple want to appear like an <code>&lt;a&gt;</code> link.  If the user clicks it, I want <code>JavaScript</code> pop up box to appear with user entering the email.  I want them to hit ok, and I send that email value back to the form and the form then submits via a php post.</p>
  
  <p>I do not know how to grab the value from the box and insert it in the <code>form</code> (if possible) so it can submit to <code>php</code>.</p>
  
  <p>Here is the code:</p>
  
  <pre><code>    &lt;form id="frm1" action="login.php" method = "post"&gt;
          &lt;input onclick="resetPassword()" type="text" name="email" value="Reset Password" style="cursor: pointer; background:none; text-decoration: underline; border: none;"  /&gt;
      &lt;/form&gt;
  
  
      &lt;script&gt;
          function resetPassword() {
          var x;
  
          var email=prompt("Enter email to reset password.", "example@email.com");
  
          if (email!=null)
            {
            document.getElementById("frm1").submit();
            }
          }
     &lt;/script&gt;
  
  
    &lt;?php 
       if (isset($_POST['email'])) {
           $email = $database -&gt; escape_value(trim($_POST['email']));
          //  reset password    
        }
    ?&gt;
  </code></pre>