PHP,JAVASCRIPT里面的php循环

时间:2017-05-20 03:00:20

标签: javascript php

我目前正在使用投票系统。每当选民选择候选人时,javascript应该有效,但没有任何反应。这是我的代码。

<?php while ($row = $stmt->fetch()) { ?>    
    <div class="form-group">
        <div class="row">
            <label class="control-label col-md-3 col-md-push-1" id="labelpad" for="username"><?php echo $row['position']; ?></label>
                <div class="col-md-6 col-md-push-0"><br>
                    <?php 
                    $stmt1 = $con->prepare("SELECT * FROM candidate WHERE position = ?");
                    $stmt1->bindParam(1, $row['position']);
                    $stmt1->execute();
                    while ($row1 = $stmt1->fetch()) 
                    {                   
                    ?>
                    <label>
                        <input id="" class="uniform_on" name="selector[]" type="checkbox" value="<?php echo $row1['candidate_id'];?>">
                    </label>
                    <?php echo "<label>".$row1['name']."</label>"; ?><br>
                            <script>        
                                $(".uniform_on").change(function(){
                                var max= <?php $row1['vote_limit'];?>
                                if( $(".uniform_on:checked").length == max {
                                    $(".uniform_on").attr('disabled', 'disabled');
                                        alert('5 Items allowed per borrow');

                                    $(".uniform_on:checked").removeAttr('disabled');

                                }else{

                                    $(".uniform_on").removeAttr('disabled');
                                }
                                })
                            </script>
                    <?php } ?>
                </div>  
            </div>

0 个答案:

没有答案