如何将值赋值给Javascript变量值给PHP,以便我可以使用它来值,以便使用PHP存储在MySQL数据库中。
<html>
<head>
<script>
var countChecked = function(thiss) {
var n = $( "input:checked" ).length;
how to assign n to $temp?
<?php
//$con=mysqli_connect("localhost","root"," ") or die("Couldn't connect to server!");
//$db=mysqli_select_db("site",$con) or die("Couldn't select database!");
//$query="INSERT INTO temp(value) VALUES ('$temp')";
?>
};
countChecked(thiss);
</script>
<body>
<h2>Price Range</h2>
<div id="pricelabel" style="font-size: 15px; color:#696763 ;margin-left:1cm">
<input id="price" type="checkbox" name="price" onclick="countChecked(1000)" value="500">0-500</input><br>
<input id="price"type="checkbox" name="price" onclick="countChecked(1000)" value="1000">501-1000</input><br>
<input id="price"type="checkbox" name="price" onclick="countChecked(1500)"value="1500">1001-1500</input><br>
<input id="price" type="checkbox" name="price" onclick="countChecked(2000)" value="2000">1501-2000</input><br>
<input id="price" type="checkbox" name="price" onclick="countChecked(2001)" value="<2000"><2001</input><br>
<div id="p"></div>
</div>
</body>
</html>