将javascript变量变成php变量而不刷新页面

with the code I have I can echo:<a id='test'> and it displays what was typed, however I need to make<a id='test'> into a variable so I can use it for mysql query's etc. is this possible at all?

<script type="text/javascript">

   function email(){
   var input = document.getElementById('input').value;
   document.getElementById('text').innerHTML = input;
 }
</script>

<html>
  <p><input type='text' id='input' value='' />
    <input type='button' onclick='email()' value='submit'/></p>
</html>

<?php
    $info="<a id='text'>"//make this a variable;
    echo $info;
?>

using AJAX with jQuery will help you make a simple call to the server, without page reloading. Then you can send any variables to a PHP file that will store them in your database.