$ _Request不发送所有数据

时间:2016-05-13 10:55:39

标签: php html

我的下面的代码是由使用坏程序员完成以前模块的客户端提供的。代码将主题,开始日期,结束日期,中心ID和年份发送到下面代码中加载的新网址,

      $( ".centre-selection" ).each(function() {
    $( this ).attr( 'href', '?module=<?=$_REQUEST['module']?>&Subject='+ $( this ).attr('data-subject')+ '&Centre_Selected_ID='+ $( this ).attr('data-centre')+ '&Class_Selected_Year='+ $( this ).attr('data-year')+ '&Class_Selected_All='+ $( this ).attr('data-all-centre')+ '&StartDate='+ $( this ).attr('report_date_start')+ '&EndDate='+ $( this ).attr('data-attendance-check-end'));
  } );

以上代码发送中心ID和年份,但不发送其他数据。

<?php 
    $base_name = "Progress";
    $module_action = $_REQUEST['module_action'];
    ?>

<script src="../assets/plugins/table2excel/jquery.table2excel.js"></script>
<script>
    $( document ).ready(function() {$('li#module_report_pc_attendance_register').addClass( "active" );
        $('.content-header h1').html('Progress Report<small> report</small>');

    });
</script>
<style>
#centre{
    display:none;
}
#selected-centre button {
    margin-right: -10px;
}
div#pc-scrool {
    overflow-x: scroll;
}
.subject-table-code {
    display: -webkit-box;
    width: 2pt;
    height: 2pt;
    position: absolute;
    top: 2px;
    left: 1pt;
}
.report td {
    border: 1px solid black !important;
    padding: 1mm !important;
    margin: 10px !important;
    position: relative;

}
.tr-edited{
    background-image: url(../assets/img/pat.svg);
    background-size: 70px;
}
.off {
    background: #ABAAAA;
}
.registered_yes_am {
    background: #ffffff !important;
}
.registered_yes_pm {
    background: #ffffff !important;
}

td.day-full {
    border-top-color: black !important;
    border-top-style: solid !important;
    border-top-width: 3px !important;
    border-left-color: black !important;
    border-left-width: 3px !important;
    border-bottom-color: black !important;
    border-bottom-width: 1px !important;
    border-right-color: black !important;
    border-right-width: 3px !important;
}
td.day-am {
    border-top-color: black !important;
    border-top-style: solid !important;
    border-top-width: 1px !important;
    border-left-color: black !important;
    border-left-width: 3px !important;
    border-bottom-color: black !important;
    border-bottom-width: 1px !important;
    border-right-color: black !important;
    border-right-width: 1px !important;
}
td.day-pm {
    border-top-color: black !important;
    border-top-style: solid !important;
    border-top-width: 1px !important;
    border-left-color: black !important;
    border-left-width: 1px !important;
    border-bottom-color: black !important;
    border-bottom-width: 1px !important;
    border-right-color: black !important;
    border-right-width: 3px !important;
}
td.day-full {
    width: 16.666666%;
}

.day-pm, .day-am {
     width: 1%;
    <?php if($_REQUEST[page_type] == 'minimal'){ ?>
    width: 2mm;
    height: 2mm;
    <?php } ?>
}
.attendence-cell{
    font-size: 10pt;
    font-family: monospace;
    font-weight: bolder;

}
.attendence-cell a {
    color: black;
    text-decoration: none !important;
}
td.total-name-cell {
    font-size: 10pt;

}
td.pupil-name-cell {
    font-size: 10pt;
    white-space: nowrap;
}
td.not-started{
background-image: url(../assets/img/pat.svg);
background-size: 70px;
background-color: #ABAAAA;
}
</style>

<?php
    switch ($module_action){
        /////////////////////////////
        default:
            ?>

<?php if($_REQUEST[page_type] != 'minimal'){ ?>

    <div class="col-md-12">

    <div class="row" id="selected-centre" style="display: none;">

        <a href="?module=module_progress_report"><button id="selected-centre-back" class="btn bg-red margin"><i class="fa fa-arrow-circle-left"></i></button></a> 
        <button id="selected-date" class="btn btn-flat margin" style="color: rgb(255, 255, 255); background-color: #00c0ef;"><i class="fa fa-clock-o"></i>  <span></span></button> 
        </div>
    <div class="row" id='attendance-select-date'>
    <div class="col-md-3">

    <span >
    <div class="row">
    <div class="col-md-12 range">
        <label for="class_date">Month report</label>
        <div class="input-group date">

            <input type="text" id="class_date" class="form-control"   name="report_date_start" ><span class="input-group-addon"><i class="glyphicon glyphicon-th"></i></span>
        </div>

        </div>
    </div>
    <!--
    <div class="row">
        <div class="col-md-12">
        <label for="class_date">Week report</label>
        <div class="input-group date">

            <input type="text" id="class_date_week" class="form-control"><span class="input-group-addon"><i class="glyphicon glyphicon-th"></i></span>
        </div>

        </div>
    </div>
    -->
        <div class="row">
        <div class="col-md-12 range">
        <label for="class_date">Custom range report</label>
        <div class="input-group date">

            <div class="input-daterange input-group" id="class_date_range">
                <input type="text" class="input-sm form-control" id="report_date_start" name="report_date_start" />
                <span class="input-group-addon">to</span>
                <input type="text" class="input-sm form-control" id="report_date_end" name="report_date_end" />
            </div>

        </div>

        </div>

    </div> </span>
    </div>



    <div class="col-lg-4">
    <div class="row" id="centre-class-menu">

                    <div class="col-lg-12">      
                            <!--<img src="template_system/templates/<?= $Templates_Location; ?>/prv_mini.jpg" />-->

                          <!-- small box -->
                          <div class="small-box bg-aqua" style="background-color: #<?=stringToColorCode($Centre_Name)?> !important;">
                            <div class="inner">
                              <h4>Select Subject</h4>

                            </div>
                            <div class="icon">
                              <i class="fa fa-building"></i>
                            </div>
                              <a href="#" class="small-box-footer centre-year-selection-1"  data-report-range="month">
                                  <strong>All Subjects<i class="fa fa-arrow-circle-right"></i></strong>
                            </a> 
                              <?php
                              $query = "SELECT * FROM subject";
                            //$query="SELECT * FROM $base_name";
                            $result = mysql_query($query);
                            while ($row39 = mysql_fetch_array($result)) {
                                $Referrer_ID = $row39['Subject_ID'];
                                $Referrer_Name = $row39['Subject_Name'];      
                                ?>
                             <a href="#" class="small-box-footer" data-id="<?php=$Referrer_Name?>" data-subject="<?php=$Referrer_Name?>" data-report-range="month">
                                      <?=$Referrer_Name?> <i class="fa fa-arrow-circle-right"></i>
                                    </a>         
                            <?php } ?>

                          </div>
                    </div>

    </div>
    </div>
        <div class="col-lg-5">
            <div class="alert alert-info alert-dismissable" id="alert">
                    <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
                    <h4><i class="icon fa fa-info"></i> Select date range first!</h4>
                    You can choose 2 options<br>
                    <strong>'Month report'</strong> - report for all working days in selected month.<br>
                    <strong>'Custom range</strong> report' - report for all working days in selected days range. 
            </div>

                <div class="row" id="selected-centre" style="display: none;">

            <a href="?module=module_attendance"><button id="selected-centre-back" class="btn bg-red margin"><i class="fa fa-arrow-circle-left"></i></button></a> <button id="selected-date" class="btn btn-flat margin" style="color: rgb(255, 255, 255); background-color: #00c0ef;"><i class="fa fa-clock-o"></i>  <span></span></button> <button id="selected-centre-name" class="btn btn-flat margin" style="color: rgb(255, 255, 255); background-color: rgb(119, 162, 237);"><i class="fa fa-building"></i>  <span>Hockley Centre</span></button> <button class="btn btn-flat margin" id="selected-centre-year" style="color: rgb(255, 255, 255); background-color: rgb(119, 162, 237);"><i class="fa fa-calendar-o"></i> <span>Mixed</span></button>
            </div>
        </div>


        <div class="row clearfix" id="centre" >
            <div class="col-xs-12" >
            <?php
        $query1  = "SELECT * FROM Centre WHERE `Centre_Active` = 'yes'";
        $result1 = mysql_query($query1);
        while ($row1 = mysql_fetch_array($result1)) {
           $Centre_ID = $row1['Centre_ID'];
            $Centre_Name = $row1['Centre_Name'];
            $Centre_ContactName = $row1['Centre_ContactName'];
            $Centre_Address = $row1['Centre_Address'];
            $Centre_Postcode = $row1['Centre_Postcode'];
            $Centre_Tel = $row1['Centre_Tel'];
            $Centre_Fax = $row1['Centre_Fax'];
            $Centre_Email = $row1['Centre_Email'];
            $Centre_Active = $row1['Centre_Active'];
?>

                <!--<img src="template_system/templates/<?= $Templates_Location; ?>/prv_mini.jpg" />-->





              <!-- small box -->
              <div class="small-box bg-aqua" style="background-color: #<?=stringToColorCode($Centre_Name)?> !important;">
                <div class="inner">
                  <h4><?=$Centre_Name?></h4>

                </div>
                <div class="icon">
                  <i class="fa fa-building"></i>
                </div>
                  <?php
        $query_year  = "SELECT * FROM Year WHERE Year_Centre ='$Centre_ID' AND `Year_Active` = 'yes' ORDER BY Year_Name";
        $result_year = mysql_query($query_year);
        while ($row_year = mysql_fetch_array($result_year)) {
          $Year_ID = $row_year['Year_ID'];
$Year_Name = $row_year['Year_Name'];
$Year_Centre = $row_year['Year_Centre'];
$Year_Active = $row_year['Year_Active'];
?>
         <a href="#" class="small-box-footer centre-year-selection-1 centre-selection" data-centre="<?=$Centre_ID?>" data-year="<?=$Year_Name?>" data-year-name="<?=$Year_Name2[$Year_Name]?>" data-centre-name="<?=$Centre_Name?>" data-centre-color="#<?=stringToColorCode($Centre_Name)?>" data-attendance-check="">
                  <?=$Year_Name2[$Year_Name]?> <i class="fa fa-arrow-circle-right"></i>
         </a>         
        <?php } //year loop ends ?>

              </div> <?php } // cemtre loop end ?>
            </div>

                <?php
        } //
?>


        </div>
    </div>

    <div class="row">
         <div class="col-lg-12">


    <?php
    //get values from menu screen

    $Centre_Selected_ID = $_REQUEST[Centre_Selected_ID];
    $Class_Selected_Year = $_REQUEST[Class_Selected_Year];




    if($Centre_Selected_ID && $Class_Selected_Year)
    {
    ?>
        <script>
        $( document ).ready(function() {
            $('#centre-class-menu').hide();
            $('#attendance-select-date').hide();
            $('#selected-centre').show();

        });
        </script>







    <script>
        $( document ).ready(function() {
            $('#centre-class-menu').hide();
            $('#attendance-select-date').hide();
            $('#selected-centre').show();
            $('body').addClass("sidebar-collapse");



        });
        </script>                   

      <?php     


                        //PC report start
                        //



$report_range = $_REQUEST[report_range];
$report_date_start = $_REQUEST[report_date_start];
$report_date_end = $_REQUEST[report_date_end];
$report_referrer = $_REQUEST[Referrer];

//////////////////////////////////////
//function get_all_pupils_and_timetables($report_range, $report_date_start, $report_date_end, $report_referrer, $report_pupil);
//
//
///////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////
include "pupils_timetable_maga_calss.php"; //////////////////
///////////////////////////////////////////////////////////
////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
//
//
//

//echo "<pre>"; print_r($Data_Range_Info); echo '</pre>';                  
//echo "<pre>"; print_r($PupilsArray_names[55]); echo '</pre>';


//REGISTER

?>





                        <table align="center">
                                                           <?php
        $query1  = "
                    SELECT progress_track.Progress_Report, Orders.OrderID
                    FROM time_table
                    INNER JOIN Orders
                    ON progress_track.Progress_Report=pupils.Pupils_ID
                    WHERE progress_track.CentreID =;
        ";
        $result = mysql_query($query1);
        while ($row_year = mysql_fetch_array($result)) {
            $Year_ID[] = $row_year['Progress_Report_ID'];
            echo $Year_ID;
        }
?>
                            <tr>
                                <td>

                                    <span style="display:block;text-align: center;width: 100%;"><strong><big>Progress Report (<?php echo $_GET['report_date_start'];
                                    if($_GET['report_date_end']!= "undefined")  {
                                        echo " - ".$_GET['report_date_end'];
                                    }

                                    ?>)


                                    <?php
                                            $query2  = "
                                                        SELECT tutors.Tutors_Name,tutors.Tutors_Surname FROM tutors INNER JOIN progress_track ON progress_track.Progress_Report_Tutor_ID=tutors.tutors_ID   
                                            ";
                                            $result = mysql_query($query2);
                                            while ($row_year = mysql_fetch_array($result)) {
                                                $tutor= $row_year['Tutors_Name'];
                                                $tutor_last= $row_year['Tutors_Surname'];
                                            }
                                    ?>

                                    <br><span><?php echo $_GET['Subject'] ?> - Tutor: <?php echo $tutor." ".$tutor_last?></span>
                                </td>
                            </tr>
                            <tr>
                            <th>Centre : Hockey Center</th>
                            <?php
                                            $query3  = "
                                                        SELECT pupils.pupils_Surname,pupils.Pupils_FirstName FROM pupils INNER JOIN progress_track ON progress_track.Progress_Report_Pupils_ID=pupils.pupils_ID 
                                            ";
                                            $result = mysql_query($query2);
                                            while ($row_year = mysql_fetch_array($result)) {
                                                $pupil1= $row_year['Pupils_Surname'];
                                                $pupil2= $row_year['Pupils_FirstName'];
                                            }
                                    ?>
                            </tr>
                            <tr>
                            <th>Centre : Magnet Center</th>
                            </tr>
                            <tr>
                            <th>Centre : Hollymoor Center</th>
                            </tr>
                            <tr>
                            <th>Centre : Erdington Center</th>
                            </tr>
                        </table>




     <script>
        $( document ).ready(function() {
            $('#centre-class-menu').hide();
            $('#attendance-select-date').hide();
            $('#selected-centre').show();
            $('#selected-centre-name span').html('<?=$Centre_Name2[$Time_Table_Centre]?>');
            $('#selected-centre-year span').html('<?=$Year_Name2[$Time_Table_Year]?>');
            $('#selected-date span').html('');
            $('#selected-centre-year,#selected-centre-name').css('background-color','#<?php echo stringToColorCode($Centre_Name2[$Time_Table_Centre])?>');
        });
        </script>
  <?php if($_REQUEST[page_type] != 'minimal'){ ?>       
</div>
</div>
        </div>
  <?php } ?> 

    <?php

        } // * end if center and date is selected
    ?>


<?php if($_REQUEST[page_type] != 'minimal'){ ?>
<script>



$(function () {

     $("#save_excel").click(function(){
                $(".report").table2excel({
                  // exclude CSS class
                  exclude: ".noExl",
                  name: "Progress Report",
                  filename: "<?=$Referrer_Name2[$_REQUEST[Referrer]]?>Test <?=$Raport_Data_Renge_Start?> - <?=$Raport_Data_Renge_End?>"
                }); 
              });

    //$("#class_date").inputmask("yyyy/mm", {"placeholder": "yyyy/mm/"});

    $('#class_date').datepicker({
    format: "yyyy/mm/dd",
    endDate: "-infinity",
    minViewMode: 1,
    todayBtn: "linked",
    clearBtn: true,
    autoclose: true
});
    $('#class_date_week').datepicker({
    format: "yyyy/mm/dd",
    weekStart: 1,
    endDate: "-infinity",
    todayBtn: "linked",
    clearBtn: true,
    daysOfWeekDisabled: "0,6",
    autoclose: true
});
$('#class_date_range').datepicker({
    format: "yyyy/mm/dd",
    weekStart: 1,
    endDate: "-infinity",
    todayBtn: "linked",
    clearBtn: true,
    daysOfWeekDisabled: "0,6",
    autoclose: true
});

});

$( document ).ready(function() {  

    if( !$('#class_date').val() ) {
          $('#centre-class-menu').slideUp();
             $( ".small-box-footer" ).click(function() {

                              //   $('.small-box-footer').slideToggle("fast");
                                // $('.inner').slideToggle("fast");
        $("#centre-class-menu").toggle();
$("#alert").toggle();
$("#centre").toggle();
$(".range").toggle();



          });
    }
    else{
        $('#centre-class-menu').slideDown();
        $('.centre-year-selection').attr('data-attendance-check', $('#class_date').val());
        $( ".small-box-footer" ).click(function() {
                          //   $('.small-box-footer').slideToggle("fast");
                            //   $('.inner').slideToggle("fast");
        $("#centre-class-menu").toggle();
        $("#alert").toggle();
        $("#centre").toggle();
        $(".range").toggle();


          });
    }    


              $( ".centre-selection" ).each(function() {
            $( this ).attr( 'href', '?module=<?=$_REQUEST['module']?>&Subject='+ $( this ).attr('data-subject')+ '&Centre_Selected_ID='+ $( this ).attr('data-centre')+ '&Class_Selected_Year='+ $( this ).attr('data-year')+ '&Class_Selected_All='+ $( this ).attr('data-all-centre')+ '&StartDate='+ $( this ).attr('report_date_start')+ '&EndDate='+ $( this ).attr('data-attendance-check-end'));
          } );






});

//on change val in monthly date picker - The firing of the the subject
$("#class_date").change(function() {    

    if( !$('#class_date').val() ) {
          $('#centre-class-menu').slideUp();
          $( ".centre-year-selection" ).each(function() {
            $( this ).attr( 'href', '?module=<?=$_REQUEST['module']?>&?Subject='+ $( this ).attr('data-referrer')+ '&Centre_Selected_ID='+ '1'+ '&Class_Selected_Year='+ $( this ).attr('data-year')+ '&Class_Selected_All='+ $( this ).attr('data-all-centre'));
          });
    }
    else{
        $('#centre-class-menu').slideDown();
        $('.centre-year-selection').attr('data-attendance-check', $('#class_date').val());
        $( ".centre-year-selection" ).each(function() {
            $( this ).attr( 'href', '?module=<?=$_REQUEST['module']?>&Subject='+ $( this ).attr('data-referrer')+ '&report_date_start='+ $( this ).attr('data-attendance-check')+ '&report_date_end='+ $( this ).attr('data-attendance-check-end')+ '&Centre_Selected_ID='+ $( this ).attr('data-centre')+ '&Class_Selected_Year='+ $( this ).attr('data-year')+ '&Class_Selected_All='+ $( this ).attr('data-all-centre')+ '&report_range=month');
          });
    }

});

//firing of subject ends
//on change val in custom range data picker
$("#report_date_end").change(function() {   

    if( !$('#report_date_end').val() ) {
          $('#centre-class-menu').slideUp();
          $( ".centre-year-selection" ).each(function() {
            $( this ).attr( 'href', '?module=<?=$_REQUEST['module']?>&Subject='+ $( this ).attr('data-referrer')+ '&Centre_Selected_ID='+ $( this ).attr('data-centre')+ '&Class_Selected_Year='+ $( this ).attr('data-year')+ '&Class_Selected_All='+ $( this ).attr('data-all-centre'));
          });
    }
    else{
        $('#centre-class-menu').slideDown();
        $('.centre-year-selection').attr('data-attendance-check', $('#report_date_start').val());
        $('.centre-year-selection').attr('data-attendance-check-end', $('#report_date_end').val());
        $( ".centre-year-selection" ).each(function() {
            $( this ).attr( 'href', '?module=<?=$_REQUEST['module']?>&Subject='+ $( this ).attr('data-referrer')+ '&report_date_start='+ $( this ).attr('data-attendance-check')+ '&report_date_end='+ $( this ).attr('data-attendance-check-end')+ '&Centre_Selected_ID='+ $( this ).attr('data-centre')+ '&Class_Selected_Year='+ $( this ).attr('data-year')+ '&Class_Selected_All='+ $( this ).attr('data-all-centre')+ '&report_range=range');
          });
    }

});




/////////
function check_class_date(){

    if( !$('#class_date').val() ) {
          $('#centre-class-menu').slideUp();
        $(".centre-year-selection").each(function() {
            $(".centre-year-selection").toggle();
        });

         $(".centre-year-selection").click(function(){
        $("#centre-class-menu").toggle();
        $("#alert").toggle();
    });

          /*
          $( ".centre-year-selection" ).each(function() {
            $( this ).attr( 'href', '?module=<?=$_REQUEST['module']?>&Subject='+ $( this ).attr('data-referrer')+ '&Centre_Selected_ID='+ $( this ).attr('data-centre')+ '&Class_Selected_Year='+ $( this ).attr('data-year')+ '&Class_Selected_All='+ $( this ).attr('data-all-centre'));
          } );
          */

    }
    else{
        $('#centre-class-menu').slideDown();
        $('.centre-year-selection').attr('data-attendance-check', $('#class_date').val());

         $(".centre-year-selection").click(function(){
        $("centre-class-menu").toggle();
    });
        /*
        $( ".centre-year-selection" ).each(function() {
            $( this ).attr( 'href', '?module=<?=$_REQUEST['module']?>&Subject='+ $( this ).attr('data-referrer')+ '&report_date_start='+ $( this ).attr('data-attendance-check')+ '&report_date_end='+ $( this ).attr('data-attendance-check-end')+ '&Centre_Selected_ID='+ $( this ).attr('data-centre')+ '&Class_Selected_Year='+ $( this ).attr('data-year')+ '&Class_Selected_All='+ $( this ).attr('data-all-centre')+ '&report_range='+ $( this ).attr('data-report-range'));
          });
        */
          }

};

</script>

<?php } ?>

<?php
 break;case "edit": ?>



  <?php 
            break;
        case "new":
            ?>


  <?php
 break;} ?>

修改

在看到html之后,如果已经知道多个类中存在data-subject,这显然使得无法获得正确的值。

 <strong>All Subjects<i class="fa fa-arrow-circle-right"></i></strong>
                            </a> 
                                                         <a href="#" class="small-box-footer" data-id="<?php=$Referrer_Name?>"   data-subject="GCSE Maths"   data-report-range="month">
                                      GCSE Maths <i class="fa fa-arrow-circle-right"></i>
                                    </a>         
                                                         <a href="#" class="small-box-footer" data-id="<?php=$Referrer_Name?>"   data-subject="GCSE English"   data-report-range="month">
                                      GCSE English <i class="fa fa-arrow-circle-right"></i>
                                    </a>         
                                                         <a href="#" class="small-box-footer" data-id="<?php=$Referrer_Name?>"   data-subject="GCSE Science"   data-report-range="month">
                                      GCSE Science <i class="fa fa-arrow-circle-right"></i>
                                    </a>         
                                                         <a href="#" class="small-box-footer" data-id="<?php=$Referrer_Name?>"   data-subject="GCSE Art"   data-report-range="month">
                                      GCSE Art <i class="fa fa-arrow-circle-right"></i>
                                    </a>         
                                                         <a href="#" class="small-box-footer" data-id="<?php=$Referrer_Name?>"   data-subject="GCSE Sociology"   data-report-range="month">
                                      GCSE Sociology <i class="fa fa-arrow-circle-right"></i>
                                    </a>         
                                                         <a href="#" class="small-box-footer" data-id="<?php=$Referrer_Name?>"   data-subject="OCR Nationals ICT"   data-report-range="month">
                                      OCR Nationals ICT <i class="fa fa-arrow-circle-right"></i>
                                    </a>         
                                                         <a href="#" class="small-box-footer" data-id="<?php=$Referrer_Name?>"   data-subject="OCR Nationals Sports"   data-report-range="month">
                                      OCR Nationals Sports <i class="fa fa-arrow-circle-right"></i>
                                    </a>         
                                                         <a href="#" class="small-box-footer" data-id="<?php=$Referrer_Name?>"   data-subject="OCR Nationals Business Studies"   data-report-range="month">
                                      OCR Nationals Business Studies <i class="fa fa-arrow-circle-right"></i>
                                    </a>         
                                                         <a href="#" class="small-box-footer" data-id="<?php=$Referrer_Name?>"   data-subject="Entry Science"   data-report-range="month">
                                      Entry Science <i class="fa fa-arrow-circle-right"></i>
                                    </a>         
                                                         <a href="#" class="small-box-footer" data-id="<?php=$Referrer_Name?>"   data-subject="Functional Skills English"   data-report-range="month">
                                      Functional Skills English <i class="fa fa-arrow-circle-right"></i>
                                    </a>         
                                                         <a href="#" class="small-box-footer" data-id="<?php=$Referrer_Name?>"   data-subject="Functional Skills Maths"   data-report-range="month">
                                      Functional Skills Maths <i class="fa fa-arrow-circle-right"></i>
                                    </a>         
                                                         <a href="#" class="small-box-footer" data-id="<?php=$Referrer_Name?>"   data-subject="ESOL"   data-report-range="month">
                                      ESOL <i class="fa fa-arrow-circle-right"></i>
                                    </a>         
                                                         <a href="#" class="small-box-footer" data-id="<?php=$Referrer_Name?>"   data-subject="Preparation for Working Life"   data-report-range="month">
                                      Preparation for Working Life <i class="fa fa-arrow-circle-right"></i>
                                    </a>         

                          </div>
                    </div>

    </div>

2 个答案:

答案 0 :(得分:1)

可以在没有进一步背景的情况下做出一些评论:

  • 注入的javascript值未被转义(例如$( this ).attr('data-centre'))。例如,如果它们包含以下字符:&=?,则url语法将出错,您可能无法在服务器端获取所有值。
  • 您是否尝试在服务器端调试var_dump($_REQUEST);?你确定你没有得到所有的价值吗?一定要尽可能早地把它放在脚本上,这样它们的值就不会被你的坏程序员引入的一些流氓代码所突变。
  • 您是否尝试将整个汇编后的javascript字符串放入变量中,然后console.log查看它是否正确显示?

    $(".centre-selection").each(function() {
       var string = '?module=<?=$_REQUEST['module']?>...'; 
       console.log(string); 
       $( this ).attr( 'href', string); });
祝你好运:)

答案 1 :(得分:0)

您正在生成的网址中根本没有密钥module_action

除此之外,您需要正确编码值以便在网址中使用。

在php中,您可以使用urlencode(),在javascript中,您可以使用encodeURIComponent()

因此,您在javascript中构建网址的行应该看起来或多或少:

$( this ).attr( 'href', '?module=<?=urlencode($_REQUEST['module']);?>&Subject=' 
    + encodeURIComponent($( this ).attr('data-subject')) + '&Centre_Selected_ID='
    + encodeURIComponent($( this ).attr('data-centre')) + '&Class_Selected_Year='
    + encodeURIComponent($( this ).attr('data-year')) + '&Class_Selected_All='
    + encodeURIComponent($( this ).attr('data-all-centre')) + '&StartDate='
    + encodeURIComponent($( this ).attr('report_date_start')) + '&EndDate='
    + encodeURIComponent($( this ).attr('data-attendance-check-end')));

如果还有其他问题,你应该发布周围的代码,因为不清楚你是从php回复还是直接写javascript。