Jump to content

checkbox type...calculation


nrsh_ram

Recommended Posts

hi to all....

i really need help....

 

in my system have function where a mentor can tick the mentee`s attendance..

 

for this..im using "checkbox"...so it will generate for each mentee name

so, i want wen i mark the checkbox,the system will calculate how many names i marked...

 

how to do it?

 

 

<input name="mentee_list[]" type="checkbox" value="1" multiple="multiple" option><?php echo $row["mentee"]; ?><br /></option>

Link to comment
Share on other sites

To start with the follwoing is wrong;

 

<input name="mentee_list[]" type="checkbox" value="1" multiple="multiple" option><?php echo $row["mentee"]; ?><br /></option>

 

It should be;

 

<input name="mentee_list[]" type="checkbox" ><?php echo $row["mentee"]; ?>

 

Then in your php code;

 

<?php
$num_attend = count($_POST['mentee_list']);
echo $num_attend;

 

EDIT - don't forget the html changes, CV got the PHP for you

Link to comment
Share on other sites

the full code of tat page

 

 

 

<?php
require_once('include/session.php');
require_once('include/user_auth_fns.php');

$view = 0;
$aa = 0;	
$cur_login = $_SESSION["username"];

if($_GET["f"]=="newform" or $_GET["f"]=="edit" or $_GET["f"]=="preview"){				// click on NEW or EDIT button
$view = 1;
}


if($_GET["f"]=="newform"){		// click on NEW FORM button
$save_mode = "save_new";
}


if($_GET["f"]=="edit"){		// click on EDIT button
/*
if($_SESSION['userlevel'] == 2 and $_GET["chklock"] == "Y"){ 
		$view = 0; ?>
		<SCRIPT LANGUAGE="Javascript">
			alert('This record is locked!');
		</SCRIPT> <?php		
}else{ */
	$save_mode = "save_edit";
	$tmp_id = $_GET["rid"];
	//$rid = $_GET["rid"];

	//$rid = $_GET["rid"];
	$view = 1;

	$conn3 = db_connect();
	$query3 = "select * from attendance where atd_id = $tmp_id ";
	$result3 = $conn3->query($query3);		

	//echo $query3;

	if($result3->num_rows >0){
		$row3 = mysqli_fetch_assoc($result3);

		$lecturer       = $row3["lecturer"];	
		$lec_username	= $row3["lec_username"];
		$date_taken		= $row3["date_taken"];	
		$list_mentee	= $row3["list_mentee"];	
		$ttl_mentee		= $row3["ttl_mentee"];	
		$mentee_abs		= $row3["mentee_abs"];	
		$p_lockyn 		= $row3["lockyn"];
	}		
//}
}


if($_GET["f"]=="preview"){		// click on PREVIEW button
/*
if($_SESSION['userlevel'] == 2 and $_GET["chklock"] == "Y"){ 
		$view = 0; ?>
		<SCRIPT LANGUAGE="Javascript">
			alert('This record is locked!');
		</SCRIPT> <?php		
}else{ */
	$rid = $_GET["rid"];
	$view = 1;

	$conn3 = db_connect();
	$query3 = "select * from attendance where atd_id = $rid ";
	$result3 = $conn3->query($query3);		

	//echo $query3;

	if($result3->num_rows >0){
		$row3 = mysqli_fetch_assoc($result3);

		$lecturer       = $row3["lecturer"];	
		$lec_username	= $row3["lec_username"];
		$date_taken		= $row3["date_taken"];	
		$list_mentee	= $row3["list_mentee"];	
		$ttl_mentee		= $row3["ttl_mentee"];	
		$mentee_abs		= $row3["mentee_abs"];	
		$p_lockyn 		= $row3["lockyn"];

		//$p_c_date_prev = $p_c_date;
	}	
//}	
}


if($_GET["f"]=="lock"){		// click on LOCK @ UNLOCK button

//echo ">>> ".$_GET["f"];

if($_SESSION['userlevel'] == 3 or $_SESSION['userlevel'] == 2){
	$rid = $_GET["rid"];
	$lockyn = $_GET["locked"];
	$view = 0;		

	if($lockyn == "N"){ $newlockyn = "Y"; }
	if($lockyn == "Y"){ $newlockyn = "N"; }

	$conn4 = db_connect();
	$query4 = "update attendance set lockyn = '$newlockyn' where atd_id = $rid ";
	$result4 = $conn4->query($query4);		

	if($result4){ ?>
		<SCRIPT LANGUAGE="Javascript">
			alert('The change has been done!');
		</SCRIPT> <?php	
	}else{ ?>
		<SCRIPT LANGUAGE="Javascript">
			alert('The change has NOT been done!');
		</SCRIPT> <?php	
	}
}else{?>
		<SCRIPT LANGUAGE="Javascript">
			alert('Your user level has NOT access right to change the lock mode!');
		</SCRIPT> <?php		
}
}


if($_GET["f"]=="delete"){		// click on DELETE button
/*
if($_SESSION['userlevel'] == 2 and $_GET["chklock"] == "Y"){ 
		$view = 0; ?>
		<SCRIPT LANGUAGE="Javascript">
			alert('This record is locked!');
		</SCRIPT> <?php		
}else{ */
	$rid = $_GET["rid"];
	$view = 0;	 

	$conn5 = db_connect();
	$query5 = "delete from attendance where atd_id = $rid ";
	$result5 = $conn5->query($query5);		

	//echo $query5;

	if($result5){ ?>
		<SCRIPT LANGUAGE="Javascript">
			alert('The record has been deleted!');
		</SCRIPT> <?php	
	}else{ ?>
		<SCRIPT LANGUAGE="Javascript">
			alert('The record has NOT been deleted!');
		</SCRIPT> <?php	
	} 
//}
}



if($_POST['submitvalue1']){

$view = 0;	

$lecturer 			= $_POST["lecturer"];
$lec_username		= $_POST["lec_username"];
$date_taken 		= $_POST["date_taken"];
$list_mentee 		= $_POST["list_mentee"];
$ttl_mentee 		= $_POST["ttl_mentee"];
$mentee_abs 		= $_POST["mentee_abs"];
$atd_adddte			= date('Y-m-d');

if($mentee_abs < 0 or $ttl_mentee < 0){?>
	<SCRIPT LANGUAGE="Javascript">
		alert('Minimun value of attendance is zero!');
	</SCRIPT> <?php		
}else{

	if($mentee_abs > $ttl_mentee){ ?>
			<SCRIPT LANGUAGE="Javascript">
				alert('Number of absence is MORE than total mentee!');
			</SCRIPT> <?php	
	}else{

		if($_POST["rd_lock"] <> "N" and $_POST["rd_lock"] <> "Y"){
			$lockyn = "N";
		}else{
			$lockyn = $_POST["rd_lock"];
		}

		$conn = db_connect();		



		if($_POST["h_save_mode"]=="save_edit"){
			$rid = $_POST["cons_id"];
			$chk_remaindte = $_POST["chk_remaindte"];  // determine to update the DATE field		

			if($chk_remaindte == 1){  // NOT update

					if($_SESSION['userlevel'] == 3){
						$query = " update attendance set ".
									" lecturer      	= '$lecturer', ".
									" lec_username		= '$lec_username', ".
									//" date_taken		= '$date_taken', ".
									" list_mentee		= '$list_mentee', ".
									" ttl_mentee		= '$ttl_mentee', ".
									" mentee_abs		= '$mentee_abs', ".		 
									" lockyn 			= '$lockyn' ".	
								 " where atd_id = $rid ";
					}else{
						$query = " update attendance set ".
									" lecturer      	= '$lecturer', ".
									" lec_username		= '$lec_username', ".
									//" date_taken		= '$date_taken', ".
									" list_mentee		= '$list_mentee', ".
									" ttl_mentee		= '$ttl_mentee', ".
									" mentee_abs		= '$mentee_abs', ".
									" lockyn 			= '$lockyn' ".	
								 " where atd_id = $rid ";	
					}

			}else{					  // update

					if($_SESSION['userlevel'] == 3){
						$query = " update attendance set ".
									" lecturer      	= '$lecturer', ".
									" lec_username		= '$lec_username', ".
									" date_taken		= '$date_taken', ".
									" list_mentee		= '$list_mentee', ".
									" ttl_mentee		= '$ttl_mentee', ".
									" mentee_abs		= '$mentee_abs', ".		 
									" lockyn 			= '$lockyn' ".	
								 " where atd_id = $rid ";
					}else{
						$query = " update attendance set ".
									" lecturer      	= '$lecturer', ".
									" lec_username		= '$lec_username', ".
									" date_taken		= '$date_taken', ".
									" list_mentee		= '$list_mentee', ".
									" ttl_mentee		= '$ttl_mentee', ".
									" mentee_abs		= '$mentee_abs', ".
									" lockyn 			= '$lockyn' ".	
								 " where atd_id = $rid ";	
					}		
			}

			//echo $query;
			$result = $conn->query($query);

			if(!$result){ ?>
				<SCRIPT LANGUAGE="Javascript">
					alert('Update form is fail!');
				</SCRIPT> <?php			
			}else{ ?>
				<SCRIPT LANGUAGE="Javascript">
					alert('Update form is success!');
				</SCRIPT> <?php
			}				 					 
		}

		if($_POST["h_save_mode"]=="save_new"){
			$query = "insert into attendance ".
					 "(lecturer,lec_username,date_taken,list_mentee,ttl_mentee,mentee_abs,atd_adddte,lockyn) values ".
					 "('$lecturer','$lec_username','$date_taken','$list_mentee','$ttl_mentee','$mentee_abs','$atd_adddte','$lockyn') ";
			$result = $conn->query($query);

			//echo $query;

			if(!$result){ ?>
				<SCRIPT LANGUAGE="Javascript">
					alert('Submission attendance form is fail!');
				</SCRIPT> <?php
			}else{?>
				<SCRIPT LANGUAGE="Javascript">
					alert('Submission attendance form is success!');
				</SCRIPT> <?php
			}	
		}
	}
}
}

$conn2 = db_connect();
$query2 = "select * from attendance where lec_username='$cur_login' ";
$result2 = $conn2->query($query2);	


/* if($_POST["Go"]){

$u_mentee_list = $_POST['mentee_list'];
$u_mentor = $_POST['mentor'];

$conn = db_connect();

$query1 = "select * from user where username = '$u_mentor'  "; 
$result1 = $conn->query($query1);	
if($result1->num_rows > 0){
	$row1 = mysqli_fetch_assoc($result1);	
	$name_mentor = $row1["name"];
}

if( is_array($u_mentee_list)){
	while (list ($key, $u_mentee) = each ($u_mentee_list)) {
		$query = "select * from user where username = '$u_mentee'  "; 
		$result = $conn->query($query);
		if($result->num_rows > 0){
			$row = mysqli_fetch_assoc($result);	
			$name_mentee = $row["name"];
		}			

		//$query2 = "update mentormentee set mentor= '$name_mentor' , username_mentor= '$u_mentor'  WHERE username_mentee='$u_mentee' "; 
		//$result2 = $conn->query($query2);						
	}
}				
} */

?>



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<title>Untitled Document</title>
<script LANGUAGE="JavaScript">
<!--
// Nannette Thacker http://www.shiningstar.net
function confirmSubmit()
{
var agree=confirm("Are you sure you wish to continue?");
if (agree)
return true ;
else
return false ;
}
// -->
</script>


<script type="text/javascript" src="calendarDateInput.js">

/***********************************************
* Jason's Date Input Calendar- By Jason Moon http://calendar.moonscript.com/dateinput.cfm
* Script featured on and available at http://www.dynamicdrive.com
* Keep this notice intact for use.
***********************************************/

</script>  
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>


<script type="text/javascript">
<!--
ddaccordion.init({
headerclass: "submenuheader", //Shared CSS class name of headers group
contentclass: "submenu", //Shared CSS class name of contents group
revealtype: "click", //Reveal content when user clicks or onmouseover the header? Valid value: "click" or "mouseover
mouseoverdelay: 200, //if revealtype="mouseover", set delay in milliseconds before header expands onMouseover
collapseprev: true, //Collapse previous content (so only one open at any time)? true/false 
defaultexpanded: [], //index of content(s) open by default [index1, index2, etc] [] denotes no content
onemustopen: false, //Specify whether at least one header should be open always (so never all headers closed)
animatedefault: false, //Should contents open by default be animated into view?
persiststate: true, //persist state of opened contents within browser session?
toggleclass: ["", ""], //Two CSS classes to be applied to the header when it's collapsed and expanded, respectively ["class1", "class2"]
togglehtml: ["suffix", "<img src='image/images/plus_n.gif' class='statusicon' />", "<img src='image/images/minus_n.gif' class='statusicon' />"], //Additional HTML added to the header when it's collapsed and expanded, respectively  ["position", "html1", "html2"] (see docs)
animatespeed: "fast", //speed of animation: integer in milliseconds (ie: 200), or keywords "fast", "normal", or "slow"
oninit:function(headers, expandedindices){ //custom code to run when headers have initalized
	//do nothing
},
onopenclose:function(header, index, state, isuseractivated){ //custom code to run whenever a header is opened or closed
	//do nothing
}
})

//-->
</script>

<script language="JavaScript" type="text/JavaScript">
<!--
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>

<link href= "2col_leftNav1.css" rel="stylesheet" type="text/css" />
<link href= "pink_menu_left.css" rel="stylesheet" type="text/css" />

<link href="dropdowntabfiles/ddcolortabs.css" rel="stylesheet" type="text/css" />
<link href="dropdowntabfiles/dropdowntabs.js" rel="stylesheet" type="text/css" />

<style type="text/css">
<!--
.style2 {color: #FF0000}
-->
</style>
</head>

<body onLoad="MM_preloadImages('image/images/pre_icon_03.gif','image/images/edit_icon_03.gif','image/images/delete_icon_03.gif')">

<div id="masthead">
  
   <div align="left"></div>
</div>

  <div id="masthead_1">
  <table width="300" border="0" align="right">
  <tr>
    <td bgcolor="#CCCCCC"><font class=label face="Verdana" size="2"><?php echo $_SESSION["name"]; ?> | time |<a href="nlogout.php"> Logout</a>   </font></td>
  </tr>
</table>
<div id="colortab_1">
<div id="colortab" class="ddcolortabs">
<ul>
<li><a href="nprofile1.php" title="profile" ><span>PROFILE</span></a></li>
<li><a href="nforms.php" title="froms" ><span>FORMS</span></a></li>
<li><a href="nmentor.php" title="mentor" ><span>MENTOR</span></a></li>
<li><a href="nmanagementee.php" title="mentee" ><span>MENTEE</span></a></li>
<li><a href="nmyannouncement.php" title="myannouncement" ><span>MY Announcement</span></a></li>
<li><a href="nmysetting.php" title="mysetting" ><span>MY SETTING</span></a></li>
</ul>
</div>
</div>
<div class="ddcolortabsline"> </div>
<!--1st drop down menu -->                                                   
<div id="dropmenu1_a" class="dropmenudiv_a">
<a href="./?pg=consult">Consultation</a>
<a href="./?pg=activity">Activity</a>
<a href="discussion.html">Discussion</a>
<a href="">Attendance</a></div>
<!--2nd drop down menu -->                                                
<div id="dropmenu2_a" class="dropmenudiv_a" style="width: 150px;">
<a href="javascript:load()">Update</a>
<a href="">Preview</a>
<a href="">Save</a></div>
  
  </div>
<div id="content"> 
  <div class="story"><form name="form" id="form" method="post" action="a2.php">
  <table width="741" border="0">
        <tr>
          <td width="735"><table width="884" border="0" align="left">
            <tr>
              <td height="56"><div align="center"><a href="a2.php?f=newform"  onmouseover="MM_swapImage('Image6','','image/images/new_icon_03.gif',1)" onMouseOut="MM_swapImgRestore()"> <img src="image/images/new_icon-shadow_03.gif" name="Image6" width="34" height="35" border="0" id="Image6" /></a>                    <input type=hidden name="submitvalue1">
                <input type=hidden name="h_save_mode">
                <input type=hidden name="cons_id">
                <input type=hidden name="bk_date">
                    <a <?php if($view==1){ ?> href="javascript:rem()"  onmouseout="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image1','','image/images/save_icon_03.gif',1)" <?php } ?> > <img src="image/images/save_icon_shaddow_03.gif" width="34" height="35" border="0" class="img" /></a> <a href="javascript:window.print()" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image2','','image/images/save_icon_print_03.gif',1)"> <img src="image/images/save_icon_print_shadow_03.gif" name="Image2" width="34" height="35" border="0" id="Image2" /></a> </div></td>
              <td width="13"> </td>
            </tr>
          </table></td>
        </tr>
        <tr>
          <td><table width="884" class="style1" height="20" border="0" align="left">
            <tr> </tr>
            <tr>
              <td width="51" bgcolor="#FFD9D9" class="style1"><div align="center" class="style13">
                  <div align="center"><span class="style12">No</span></div>
              </div></td>
              <td width="350" bgcolor="#FFD9D9" class="style1"><div align="center" class="style13"><span class="style12">Date</span></div></td>
              <td colspan="2" bgcolor="#FFD9D9" class="style1"><div align="center" class="style13"><span class="style12">Action</span></div></td>
            </tr>
            <tr>
              <?php
		while ($row2 = mysqli_fetch_assoc($result2)){ 
		$aa = $aa + 1;
		?>
              <td height="27" class="style1"><?php echo $aa; ?>
                  <div align="center"></div>
                <div align="center"></div></td>
              <td class="style1"><?php echo $row2["date_taken"]; ?></td>
              <td class="style1"><div align="center">
                  <?php
				//$tmp_id = $row2["rid"];
				//echo ">>>tmp_id: ".$tmp_id; 
				?>
                <a href="a2.php?f=preview&rid=<?php echo $row2["atd_id"]; ?>&chklock=<?php echo $row2["lockyn"]; ?>" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image4','','image/images/pre_icon_03.gif',1)"><img src="image/images/pre_icon_shadow_03.gif" name="Image4" width="27" height="27" border="0" id="Image4" /></a> <a href="a2.php?f=edit&rid=<?php echo $row2["atd_id"]; ?>&chklock=<?php echo $row2["lockyn"]; ?>" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image3','','image/images/edit_icon_03.gif',1)"><img src="image/images/edit_icon_shadiow_03.gif" name="Image3" width="27" height="27" border="0" id="Image3" /></a> <a href="a2.php?f=lock&rid=<?php echo $row2["atd_id"]; ?>&locked=<?php echo $row2["lockyn"]; ?>"> <img src=<?php if($row2["lockyn"]=="Y"){ ?>"image/images/lock_03.gif"<?php }else{ ?>"image/images/unlock_icon_03.gif"<?php } ?> name="Image8" width="27" height="27" border="0" id="Image8" /></a> <a onClick="return confirmSubmit()" href="a2.php?f=delete&rid=<?php echo $row2["atd_id"]; ?>&chklock=<?php echo $row2["lockyn"]; ?>" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image7','','image/images/delete_icon_03.gif',1)"><img src="image/images/delete_icon_s_03.gif" name="image2" width="27" height="27" border="0" id="image2" /></a></div>
                  <table border="0" cellpadding="0" cellspacing="0">
                    <tr>
                      <td></td>
                    </tr>
                </table></td>
            </tr>
            <?php } ?>
          </table></td>
        </tr>
        <tr>
          <td height="356">
		<?php 			
		if($view == 1) { ?>
		<table width="69%" border="0" align="center" cellpadding="2" cellspacing="2" bordercolor="#111111" id="AutoNumber2" style="border-collapse: collapse">
            <tr valign="top">
              <td width="161" height="26" align=left class="style1"><font class=label face="Verdana" size="2">Name of Lecturer </font></td>
              <td width="13" class="style1"><font class=label face="Verdana" size="2">:</font></td>
              <td width="469" class="style1"><font face="Verdana">
			  <?php 
			  if($_GET["f"]=="preview"){	
			  		echo "<B>".$lecturer; ?>
			  <?php
			  }else{ ?>			  
                <input name="lecturer" type="text" id="lecturer" value="<?php echo $_SESSION["name"]; ?>" readonly/>
                <input name="lec_username" type="hidden" id="lec_username" value="<?php echo $_SESSION["username"]; ?>">
		      <?php 
			  } ?>				
              </font><font size="2" face="Verdana"> </font></td>
            </tr>
            <tr valign="top">
              <td height="26" align=left class="style1"><font size="2" face="Verdana">Date</font></td>
              <td width="13" class="style1"><font class=label face="Verdana" size="2">:</font></td>
              <td class="style1">
			  <?php 
			  if($_GET["f"]=="preview"){	
			  		echo "<B>".$date_taken; ?>
			  <?php
			  }else{ 
				if($_GET["f"]=="edit"){	
					//$p_c_date_prev = $p_c_date;   ?>			  
			<script>
					//DateInput('c_date', true, 'YYYY-MM-DD', <?php if($_GET["f"]=="edit"){ echo $p_c_date; } ?>)
					DateInput('date_taken', true, 'YYYY-MM-DD')
					</script> <?php
				}else{
			  		?>							
					<script>
					//DateInput('c_date', true, 'YYYY-MM-DD', <?php if($_GET["f"]=="edit"){ echo $p_c_date; } ?>)
					DateInput('date_taken', true, 'YYYY-MM-DD')
					</script>
					<?php 
				  } 
			  }?>
			  
			  <?php if($_GET["f"]=="edit"){ ?>		                       
                        <input name="chk_remaindte" type="checkbox" id="chk_remaindte" value="1" />
                        <span class="style14 style2">Check this if do NOT want to update the DATE field. </span>
                        <?php } ?>              </td>
            </tr>
            <tr valign="top">
              <td height="23" align="left" class="style1"> </td>
              <td class="style1"> </td>
              <td class="style1"> </td>
            </tr>
            <tr valign="top">
              <td height="23" align="left" class="style1"><font face="Verdana" size="2"><font class=label>Name List Of Mentee</font></font></td>
              <td width="13" class="style1"><font face="Verdana" size="2"><font class=label>:</font></font> </td>
              <td class="style1"><font face="Verdana">
                <?php 
			  if($_GET["f"]=="preview"){	
			  		echo "<B>".$list_mentee; ?>
                <?php
			  }else{ ?>
                 <!--<textarea name="list_mentee" cols="40" rows="5" class="textbox" id="list_mentee"><?php echo $list_mentee; ?> </textarea> -->
			 <?php	  
    $conn = db_connect();	  
       	$query = "SELECT * FROM mentormentee where username_mentor = '$cur_login'";

        $result = $conn->query($query);
        			
        while($row = mysqli_fetch_assoc($result)){ ?>
<input name="mentee_list[]" type="checkbox" ><?php echo $row["mentee"]; ?><br />
	<!--<input name="mentee_list[]" type="checkbox" value="1" multiple="multiple" option><?php echo $row["mentee"]; ?><br /></option>-->
	<!--from net-->
	<?php
$num_attend = count($_POST['mentee_list']);
$total= $num_attend;
?>

	  <?php 
	} ?>
    </select>  
                <?php 
			  } ?> 
                <label><a href="php_doc_xls_gen.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image9','','image/images/delete_icon_03.gif',1)"></a></label>
              </font></td>
            </tr>
            <tr valign="top">
              <td height="26" align=left class="style1"> </td>
              <td class="style1"> </td>
              <td class="style1"> </td>
            </tr>
            <tr valign="top">
              <td height="26" align=left class="style1"><font face="Verdana" size="2"><font class=label>Total Mentee</font></font></td>
              <td class="style1"><font class=label face="Verdana" size="2">:</font></td>
              <td class="style1"><FONT face=Verdana>
			  <?php 
			  if($_GET["f"]=="preview"){	
			  		echo "<B>".$ttl_mentee; ?>
			  <?php
			  }else{ ?>		
			  
			  	<INPUT name="ttl_mentee" class=textbox id="ttl_mentee" size=10 maxLength=5 value="<?php echo $total; ?>">	  
                <!--<INPUT name="ttl_mentee" class=textbox id="ttl_mentee" size=10 maxLength=5 value="<?php echo $ttl_mentee; ?>">
			<INPUT name="ttl_mentee" class=textbox id="ttl_mentee" size=10 maxLength=5 value="<?php echo $c; ?>" />-->
			<?php 
			  } ?>				
              </FONT></td>
            </tr>
            <tr valign="top">
              <td height="26" align=left class="style1"><font size="2" face="Verdana">Mentee Absance</font></td>
              <td class="style1"><font class=label face="Verdana" size="2">:</font></td>
              <td class="style1"><font face=Verdana>
			  <?php 
			  if($_GET["f"]=="preview"){	
			  		echo "<B>".$mentee_abs; ?>
			  <?php
			  }else{ ?>				  
                <input name="mentee_abs" class=textbox id="mentee_abs" size=10 maxlength=5 value="<?php echo $mentee_abs; ?>">
			<?php 
			  } ?>				
              </font><font size="2" face="Verdana"> </font></td>
            </tr>
            <tr valign="top">
              <td height="26" align=left class="style1"> </td>
              <td class="style1"> </td>
              <td class="style1"> </td>
            </tr>

		<?php if($_SESSION["userlevel"] == 3 or $_SESSION['userlevel'] == 2 or $_GET["f"]=="preview"){ ?>
            <tr valign="top">
              <td height="23" colspan="3" align="left" class="style1">
                <?php 
				  if($_GET["f"]=="preview"){ 
					if($p_lockyn == "Y"){
						echo "<B>"."<font color=red>"."*** LOCK ***"; 
					}else{
						echo "<B>"."<font color=red>"."*** UNLOCK ***"; 
					}	
				  }else{ ?>
                <input name="rd_lock" type="radio" value="N" <?php if($p_lockyn == "N"){ ?>checked="checked" <?php } ?>  />
  Unlock      
  <input name="rd_lock" type="radio" value="Y" <?php if($p_lockyn == "Y"){ ?>checked="checked" <?php } ?>  />
  Lock
  <?php
				  } ?>              </td>
              </tr>
		  <?php } ?>
            <tr valign="top">
              <td height="6" colspan="3" align="left" class="style1"><table width="100%" border="0" align="center" cellpadding="2" cellspacing="2" id="AutoNumber10" style="border-collapse: collapse">
              </table>            </tr>
          </table>
	  <? } ?>	</td>
        </tr>
      </table>
  <p> </p>
</form>
<script>
function rem() {
document.getElementById('form').submitvalue1.value="1";
document.getElementById('form').h_save_mode.value="<?php echo $save_mode; ?>";	
document.getElementById('form').cons_id.value="<?php echo $tmp_id; ?>";
//	document.getElementById('form').bk_date.value="<?php echo $p_c_date_prev; ?>";
document.getElementById('form').submit();
}
</script>

</div>
  <div id="breadCrumb_1"></div>
</div>

<div id="navBar">
  <div id="search"></div>

  <div class="relatedLinks">
     <h3> <div class="glossymenu">
 <a href="#"  class="menuitem">Attendance</a></div> </h3>
  </div>
</div>
</body>
</html>

Link to comment
Share on other sites

You've got some repeated javascript in there.

 

Are you trying to do this dynamically on the client side? If do you need JavaScript not PHP. If not you need to submit the form before it will work though the page tries to show it every time.

 

If you don't answer my question I can't help you, and please don't call me sir

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.