title: Using a javascript variable to set PHP variable
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/415868/get-variable-from-php-to-javascript">Get variable from PHP to JavaScript</a><br>
    <a href="https://stackoverflow.com/questions/2338942/access-a-javascript-variable-from-php">Access a JavaScript variable from PHP</a>  </p>
  </blockquote>
  
  
  
  <p>I currently have this line of code:</p>
  
  <pre><code>displaystatus('CALLER IS: '+inCallingNum);
  </code></pre>
  
  <p>which is being used to display a message on the page saying (e.g.) CALLER IS: 01234 567890.</p>
  
  <p>What I need to do now is set the value of the inCallingNum variable in a PHP variable $user_number. Is this possible?</p>
  
  <p>I tried something like this, but didnt have any luck with it:</p>
  
  <pre><code>&lt;?php $user_number ?&gt; = inCallingNum;
  </code></pre>
  
  <p>Thanks for any help</p>
  
  <p>Edit:</p>
  
  <p>This is where inCallingNum is set:</p>
  
  <pre><code>inCallingNum = inCallingNum.slice(inCallingNum.lastIndexOf(",")+1, inCallingNum.length);
  </code></pre>
  
  <p>Edit 2:</p>
  
  <p>I'll try to explain what I'm trying to do more clearly. What I have at the moment is 2 pages, the main page which displays all of the information and a 2nd page which queries the database and pulls out the user's profile. When the javascript variable inCallingNum changes, I need to send this to the user_data.php page and update the information to show the new person's profile.</p>