亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

PHP? ??? ?? ??? ?? ??? ?? ??? ?????(2)

116.png

?? ??? ??? ? ?? ??? ???? ? ????? ? ?? ?? ?? ????? ???? ? ? ????.

"?? ??"? ???? ????? ???? ? ??? ?? ?? ??? ?????.

<input type="hidden"> ??? ?? ?? ??

<input type="hidden"> ??? ??? ????? ????? ???? ????. ??? ???? ?????? ??? ??? ????. ??? ?? ??? ???? ??? ???? ??? ?? ??? ??? ?????.

hidden ??? ???? ?? ??? ??? ???(?: ??? ??) ???? ??? ? ? ??? ? ?? ????. ?? ?? JavaScript? ??? ??? ???? ? ??? ??? ? ????.

<input type="hidden" id="selected_id" name="selected_id" value="">
<input type="button" value="查看結(jié)果" onClick="location.href='index.php?id=ck'"/>&nbsp;&nbsp;
<script type="text/javascript">
    $("[type='radio']").click(function(){
       $("#selected_id").val($(this).val());
    });
</script>

??? ?? ?? ???? ???? ?? ??? ?????.

 <?php
  $id=$_POST["itm"];
  $SQL="UPDATE vote SET count=count+1 WHERE id=$id";  //自動添加投票數(shù)
  if(mysqli_query($link,$sql))
  {
  $_SESSION["vote"]=session_id();
  ?>
    <script language="javascript">alert("投票成功,點確定查看結(jié)果");location.href="index.php?id=ck";</script>
  <?php
  }
  else
  {
  ?>
    <script language="javascript">alert("投票失敗");location.href="index.php";</script>
    <?php
  }
?>

??? <table> ???? ?? ?? ??? ?????.

? ?? ?? ?? ???? ?? ??? sum()? ?? ??????? ???? ??? ?? ?? ? ??

<?php
if(isset($_GET["id"])=="ck"){
?>

  <?php
  $SQL="SELECT sum(count) as 'total' FROM vote";
  $rs=mysqli_query($link,$sql);
  $rows=mysqli_fetch_assoc($rs);
  $sum=$rows["total"];  //得出總票數(shù)
}  
  ?>

? ??? ? ??? ?? ? ?? ??? ???? SQL ? SELECT? ???? ?? ???? ?? ?? ?????. ?????? ???? ??? ?? ?? ? ?? ?? ????.

????
???? ??
||
<input type="hidden" id="selected_id" name="selected_id" value=""> <input type="button" value="查看結(jié)果" onClick="location.href='index.php?id=ck'"/>   <script type="text/javascript"> $("[type='radio']").click(function(){ $("#selected_id").val($(this).val()); }); </script>