Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/228.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
php表单上复选框的动态更新_Php - Fatal编程技术网

php表单上复选框的动态更新

php表单上复选框的动态更新,php,Php,这是我的项目,我必须选择部分,然后根据这一点,如果它的“A”,那么复选框将显示150,如果它的“B”,那么从51到100 这是我的主要代码: <html> <head> <link rel="stylesheet" type="text/css" media="all" href="jsDatePick_ltr.min.css" /> <script type="text/javascript" src="jsDatePick.min.1.3.js"&g

这是我的项目,我必须选择部分,然后根据这一点,如果它的“A”,那么复选框将显示150,如果它的“B”,那么从51到100

这是我的主要代码:

<html>
<head>
<link rel="stylesheet" type="text/css" media="all" href="jsDatePick_ltr.min.css" />
<script type="text/javascript" src="jsDatePick.min.1.3.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript">
window.onload = function(){
    new JsDatePick({
        useMode:2,
        target:"inputField",
        dateFormat:"%d-%M-%Y"
    });
};
</script>
</head>
<?php
$dept =$_COOKIE[dept];
include_once("../Include/connectdb.php");
include_once("../Include/data_menu.php");
include_once '../Include/pagemaker.php';

?>
<script type="text/javascript">
$(document).ready(function()
{
$(".batch").change(function()
{
var id=$(this).val();
var dataString = 'year_join='+ id;

$.ajax
({
type: "POST",
url: "ajax_subject.php",
data: dataString,
cache: false,
success: function(html)
{
$(".subject").html(html);
} 
});

});
});
</script>





<script type="text/javascript">
$(document).ready(function()
{
    $(".section").change(function()
    {
        alert('asdfa');
        var id=$(this).val();
        var dataString = 'section='+ id;

        $.ajax
        ({
                type: "POST",
                url: "ajax_absent.php",
                data: dataString,
                cache: false,
                success: function(html)
                {
                    $(".absent").html(html);
                } 
        });

    });
});
</script>
</head>

<body>
<fieldset class="cbox"><legend>New Attendence System</legend>
<form name="frm" action=<?php print "edit_attendencePHP_NEW.php"; ?> method="GET"    
id="content">
<br><br>

<div style="margin:80px">
<label>Batch :</label> <select name="batch" class="batch">
<option selected="selected">--Select Batch--</option>
<?php
    $result = mysql_query("select distinct year_joining from student_profile  
order by year_joining ")or die(mysql_error());

while($year = mysql_fetch_assoc($result)){
if($year[year_joining]!="" && $year[year_joining]>"2008"){

  print "<OPTION value='$year[year_joining]'>$dept $year[year_joining]</OPTION>";
}  }
 ?>
</select>

<label>Section :</label> 
<select name="section" class="section">
        <OPTION value='A'> A</OPTION>
        <OPTION value='B'> B</OPTION>
</select>

  Date :<input type="text" size="12" id="inputField" name="date"/>

  <label>Hours :</label> <select name="hour" >
        <OPTION value='1'> 1</OPTION>
        <OPTION value='1'> 2</OPTION>
        <OPTION value='1'> 3</OPTION>

</select>
</br></br>
<label>Subject :</label> <select name="subject" class="subject">
<option selected="selected">------------Choose Subject------------</option>

  </select>
 </br>
    <label>Mark the Absenties : </label> 
    <input type="checkbox" class="section">
  <br/></br>
  <div class="absent"></div>

            <input class="bluebutton" type="submit" value="Go">    
</form><br>

<label class="comment">select a batch frm the list and press "Go"</label>
</fieldset>


</body>
</html>

window.onload=函数(){
新JsDatePick({
使用模式:2,
目标:“输入字段”,
日期格式:“%d-%M-%Y”
});
};
$(文档).ready(函数()
{
$(“.batch”).change(函数()
{
var id=$(this.val();
var dataString='year\u join='+id;
$.ajax
({
类型:“POST”,
url:“ajax_subject.php”,
数据:dataString,
cache:false,
成功:函数(html)
{
$(“.subject”).html(html);
} 
});
});
});
$(文档).ready(函数()
{
$(“.section”).change(函数()
{
警报(“asdfa”);
var id=$(this.val();
var dataString='section='+id;
$.ajax
({
类型:“POST”,
url:“ajax\u缺席.php”,
数据:dataString,
cache:false,
成功:函数(html)
{
$(“.缺席”).html(html);
} 
});
});
});
新考勤系统

我为下拉菜单实现了相同的动态概念。。在同一个文件中,但复选框中只有一个复选框。

我发现了一些错误:-

您在jquery中有用户代码

$(".section").change(function()
$(".absent").html(html); 
但是节课在课堂上不见了

<select name="section" >
但是你的html代码中不存在缺少的类,请添加你的代码

<span class="absent"></span> 


试试这个

这是修改html代码

<html>
<head>
<link rel="stylesheet" type="text/css" media="all" href="jsDatePick_ltr.min.css" />
<script type="text/javascript" src="jsDatePick.min.1.3.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript">
window.onload = function(){
    new JsDatePick({
        useMode:2,
        target:"inputField",
        dateFormat:"%d-%M-%Y"
    });
};
</script>
</head>
<?php
$dept =$_COOKIE[dept];
include_once("../Include/connectdb.php");
include_once("../Include/data_menu.php");
include_once '../Include/pagemaker.php';

?>
<script type="text/javascript">
$(document).ready(function()
{
$(".batch").change(function()
{
var id=$(this).val();
var dataString = 'year_join='+ id;

$.ajax
({
type: "POST",
url: "ajax_subject.php",
data: dataString,
cache: false,
success: function(html)
{
$(".subject").html(html);
} 
});

});
});
</script>





<script type="text/javascript">
$(document).ready(function()
{
    $(".section").change(function()
    {
        alert('asdfa');
        var id=$(this).val();
        var dataString = 'section='+ id;

        $.ajax
        ({
                type: "POST",
                url: "ajax_absent.php",
                data: dataString,
                cache: false,
                success: function(html)
                {
                    $(".absent").html(html);
                } 
        });

    });
});
</script>
</head>

<body>
<fieldset class="cbox"><legend>New Attendence System</legend>
<form name="frm" action=<?php print "edit_attendencePHP_NEW.php"; ?> method="GET"    
id="content">
<br><br>

<div style="margin:80px">

<label>Section :</label> 
<select name="section" class="section">
        <OPTION value='A'> A</OPTION>
        <OPTION value='B'> B</OPTION>
</select>

  Date :<input type="text" size="12" id="inputField" name="date"/>

  <label>Hours :</label> <select name="hour" >
        <OPTION value='1'> 1</OPTION>
        <OPTION value='1'> 2</OPTION>
        <OPTION value='1'> 3</OPTION>

</select>
</br></br>
<label>Subject :</label> <select name="subject" class="subject">
<option selected="selected">------------Choose Subject------------</option>

  </select>
 </br>
    <label>Mark the Absenties : </label> 
    <input type="checkbox" class="section">
  <br/></br>
  <div class="absent"></div>

            <input class="bluebutton" type="submit" value="Go">    
</form><br>

<label class="comment">select a batch frm the list and press "Go"</label>
</fieldset>

window.onload=函数(){
新JsDatePick({
使用模式:2,
目标:“输入字段”,
日期格式:“%d-%M-%Y”
});
};
$(文档).ready(函数()
{
$(“.batch”).change(函数()
{
var id=$(this.val();
var dataString='year\u join='+id;
$.ajax
({
类型:“POST”,
url:“ajax_subject.php”,
数据:dataString,
cache:false,
成功:函数(html)
{
$(“.subject”).html(html);
} 
});
});
});
$(文档).ready(函数()
{
$(“.section”).change(函数()
{
警报(“asdfa”);
var id=$(this.val();
var dataString='section='+id;
$.ajax
({
类型:“POST”,
url:“ajax\u缺席.php”,
数据:dataString,
cache:false,
成功:函数(html)
{
$(“.缺席”).html(html);
} 
});
});
});
新考勤系统

我发现了一些错误:-

您在jquery中有用户代码

$(".section").change(function()
$(".absent").html(html); 
但是节课在课堂上不见了

<select name="section" >
但是你的html代码中不存在缺少的类,请添加你的代码

<span class="absent"></span> 


试试这个

这是修改html代码

<html>
<head>
<link rel="stylesheet" type="text/css" media="all" href="jsDatePick_ltr.min.css" />
<script type="text/javascript" src="jsDatePick.min.1.3.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript">
window.onload = function(){
    new JsDatePick({
        useMode:2,
        target:"inputField",
        dateFormat:"%d-%M-%Y"
    });
};
</script>
</head>
<?php
$dept =$_COOKIE[dept];
include_once("../Include/connectdb.php");
include_once("../Include/data_menu.php");
include_once '../Include/pagemaker.php';

?>
<script type="text/javascript">
$(document).ready(function()
{
$(".batch").change(function()
{
var id=$(this).val();
var dataString = 'year_join='+ id;

$.ajax
({
type: "POST",
url: "ajax_subject.php",
data: dataString,
cache: false,
success: function(html)
{
$(".subject").html(html);
} 
});

});
});
</script>





<script type="text/javascript">
$(document).ready(function()
{
    $(".section").change(function()
    {
        alert('asdfa');
        var id=$(this).val();
        var dataString = 'section='+ id;

        $.ajax
        ({
                type: "POST",
                url: "ajax_absent.php",
                data: dataString,
                cache: false,
                success: function(html)
                {
                    $(".absent").html(html);
                } 
        });

    });
});
</script>
</head>

<body>
<fieldset class="cbox"><legend>New Attendence System</legend>
<form name="frm" action=<?php print "edit_attendencePHP_NEW.php"; ?> method="GET"    
id="content">
<br><br>

<div style="margin:80px">

<label>Section :</label> 
<select name="section" class="section">
        <OPTION value='A'> A</OPTION>
        <OPTION value='B'> B</OPTION>
</select>

  Date :<input type="text" size="12" id="inputField" name="date"/>

  <label>Hours :</label> <select name="hour" >
        <OPTION value='1'> 1</OPTION>
        <OPTION value='1'> 2</OPTION>
        <OPTION value='1'> 3</OPTION>

</select>
</br></br>
<label>Subject :</label> <select name="subject" class="subject">
<option selected="selected">------------Choose Subject------------</option>

  </select>
 </br>
    <label>Mark the Absenties : </label> 
    <input type="checkbox" class="section">
  <br/></br>
  <div class="absent"></div>

            <input class="bluebutton" type="submit" value="Go">    
</form><br>

<label class="comment">select a batch frm the list and press "Go"</label>
</fieldset>

window.onload=函数(){
新JsDatePick({
使用模式:2,
目标:“输入字段”,
日期格式:“%d-%M-%Y”
});
};
$(文档).ready(函数()
{
$(“.batch”).change(函数()
{
var id=$(this.val();
var dataString='year\u join='+id;
$.ajax
({
类型:“POST”,
url:“ajax_subject.php”,
数据:dataString,
cache:false,
成功:函数(html)
{
$(“.subject”).html(html);
} 
});
});
});
$(文档).ready(函数()
{
$(“.section”).change(函数()
{
警报(“asdfa”);
var id=$(this.val();
var dataString='section='+id;
$.ajax
({
类型:“POST”,
url:“ajax\u缺席.php”,
数据:dataString,
cache:false,
成功:函数(html)
{
$(“.缺席”).html(html);
} 
});
});
});
新考勤系统

用MarktheAbsenties调用ajax文件:这是正确的方法吗???这部分在这里也起作用。。但是当选择节时,我无法在主页中调用此ajax页面。在ajaxcode中,您使用了工作文件名“url:“ajax_subject.php”,“您的文件名应为ajax_缺席。phpI让节下拉,当我选择“A”时,复选框应作为名称从0动态加载到50,当选择“B”时然后复选框应该在51到100之间。@AbidHussain有两种不同的动态更新,请仔细查看。。两者都是正确的。用marktheabsenties调用ajax文件:是正确的方法吗???这一部分在这里也起作用。。但是当选择节时,我无法在主页中调用此ajax页面。在ajaxcode中,您使用了工作文件名“url:“ajax_subject.php”,“您的文件名应为ajax_缺席。phpI让节下拉,当我选择“A”时,复选框应作为名称从0动态加载到50,当选择“B”时然后复选框应该在51到100之间。@AbidHussain有两种不同的动态更新,请仔细查看。。两者都是正确的。您用
关闭输入复选框,只需删除该复选框,然后以
(注意斜杠)的形式关闭输入。在ajaxcode中,您使用了工作文件名“url:”ajax\u subject.php,“您的文件名应该是ajax\u缺席。php您用
关闭输入复选框,只需删除它,并以
(注意斜杠)的形式关闭输入。在ajaxcode中,您已经使用了worng文件名“url:“ajax\u subject.php”,“您的文件名应该是ajax\u.php”