title: How to get Form Element Value using JavaScript
body: <p>I am trying to find value of the input element in a popup window which is being opened from a parent page. </p>
  
  <p>My code is below. I am getting not able to get pc value from input.</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
  &lt;? 
  $pid=$_GET['pid'];
  $cart_url = '../cart.php?action=add&amp;p='.$pid;
  echo $cart_url;
  ?&gt;  
  &lt;/head&gt;
  
  &lt;body&gt;
  &lt;SCRIPT LANGUAGE="JavaScript"&gt;
  &lt;!-- Begin
  function sendValue(val){
  window.opener.document.getElementById('details_&lt;?=$pid?&gt;').value = val;
  window.opener.location.href='&lt;?php echo $cart_url; ?&gt;&amp;pc='.concat(val);
  window.close();
  window.location.reload();
  }
  &lt;/script&gt;
  &lt;form name="selectform"&gt;
  &lt;label&gt;Enter Price:&lt;/label&gt;
  &lt;input id="1" name="details_&lt;?=$pid?&gt;" type="text"&gt;&lt;/input&gt;
  &lt;input   type="Submit"  onsubmit="sendValue(this.value)"&gt;&lt;/input&gt;
  &lt;/form&gt; 
  &lt;/body&gt;
  &lt;/html&gt; 
  </code></pre>