I have a javascript variable from a previous page that is passed to the header as "namer". Now I also want to use that variable in a sql query in php. How do I go about sending this javascript variable to php on the server side as the variable "namer"?
<!DOCTYPE html>
<html>
<head>
<title>My Page</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.css" />
<script src="http://code.jquery.com/jquery-1.8.2.min.js"></script>
<script src="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.js"> </script>
</head>
<body>
<script>
$( document ).ready(function() {
var namer = sessionStorage.getItem("namer");
$('h1').text(namer)
});
</script>
<div data-role="page" class="div1">
<div data-role="header">
<h1>"namer"</h1>
</div>
<div data-role="content">
<?php
$link = mysql_connect("xxxx", "xxxx", "xxxx") OR DIE ("Unable to connect to database! Please try again later.");
mysql_select_db("abxusername");
$query = "SELECT class FROM Antibiotics WHERE name="."namer".";";
echo $query;
echo mysql_query($query);
?>
</div>
</div>
</body>
</html>