使用php在数据库中传递js参数值

时间:2016-04-06 11:20:13

标签: javascript php mysql

<input class="stars" type="radio" id="star5" onclick="myFunction('Overall rating:',5)" name="rating" value="5" />
<label class = "full" for="star5" title="Awesome - 5 stars"></label>
<input class="stars" type="radio" id="star4" onclick="myFunction('Overall rating:',4)" name="rating" value="4" />
<label class = "full" for="star4" title="Pretty good - 4 stars"></label>
<input class="stars" type="radio" id="star3" onclick="myFunction('Overall rating:',3)" name="rating" value="3" />
<label class = "full" for="star3" title="Meh - 3 stars"></label>
<input class="stars" type="radio" id="star2" onclick="myFunction('Overall rating:',2)" name="rating" value="2" />
<label class = "full" for="star2" title="Kinda bad - 2 stars"></label>
<input class="stars" type="radio" id="star1" onclick="myFunction('Overall rating:',1)" name="rating" value="1" />
<label class = "full" for="star1" title="Sucks big time - 1 star"></label>
<font  size="4"color="#ffffff">Overall rating:</font>

如何使用php传递数据库中的js参数值?

2 个答案:

答案 0 :(得分:0)

使用ajax

myFunction的(yourString,值){

$。get('updatePage.php',{'yourkeyString':yourString,'yourValue':value},function(d){     alert('你好,来自PHP:'+ d); });

}

也可以查看这个答案 https://stackoverflow.com/a/712378/6124249

答案 1 :(得分:0)

单选按钮的

Onchange()调用ajax函数,该函数将您的响应存储在数据库中。