如何在JavaScript函数中将Javascript变量值赋给PHP变量

时间:2015-03-09 16:55:17

标签: mysql

如何将值赋值给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>

0 个答案:

没有答案