title: i want to get value from the form using javascript before submit
body: <p>I want to get value from input text form and send it to php before submit.</p>
  
  <p>Ex:
  PHP FILE:</p>
  
  <pre><code>$do="FORM VALUE HERE";     //HERE IS $_POST['search'];
  $result = mysql_query("SELECT * FROM table WHERE name='$do'");
  while($row = mysql_fetch_array($result))
    {
     $code=$row['code_number'];
    }
  </code></pre>
  
  <p>HTML:</p>
  
  <pre><code>&lt;script &gt;
  HERE WHAT I WANT TO DO
  &lt;script /&gt;
  </code></pre>
  
  <p>FORM:</p>
  
  <pre><code>&lt;form action="view_results.php?code=&lt;? echo $code ?&gt;" method="post"&gt;
  &lt;input type="text" name="search" /&gt;&lt;br /&gt;
  &lt;input type="submit" value="search" /&gt;
  &lt;form /&gt;
  </code></pre>
  
  <p>So, with this example I want to get $do=$_POST['search'] before clicking to submit botton so I can select the result from mySQL to view it in the next page.</p>
  
  <p>Thanks</p>