title: Pass javascript variables into Database with MySQL and PHP
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/406316/how-to-pass-a-variable-data-from-javascript-to-php-and-vice-versa">How to pass a variable / data from javascript to php and vice versa?</a>  </p>
  </blockquote>
  
  
  
  <p>I have 3 javascript variables which gives me an id, a name and a surname as such:</p>
  
  <pre><code>    if (!response.error) {
  
      document.getElementById("meName").innerHTML = response.id 
                                                   + " " + response.name
                                                   + " " + response.surname ;
                          }
  </code></pre>
  
  <p>Now I want to pass those variables (<code>response.id</code>, <code>response.name</code> and <code>response.surname</code>) into my database.</p>
  
  <p>Something like this:</p>
  
  <pre><code>&lt;?php
  
      $query = mysql_query("INSERT INTO users (id, name, surname) VALUES 
   ('response.id', 'response.name', 'response.surname')") or die(mysql_error());
  
  $result = mysql_fetch_array($query);
  return $result;
  
  ?&gt;
  </code></pre>
  
  <p><strong>How can I do this?</strong></p>