pop up message?

  • nrsh_ram
  • Novice
  • Novice
  • nrsh_ram
  • Posts: 30
  • Loc: malaysia

Post 3+ Months Ago

good morning,

i have create a form where mentor can preview,edit,delete and save..
here i want put a pop up message where i click another tab

this pop up message will appear when tat form in edit and new...
i want the pop up message "are u want save it?"

here i show the a2.php
Code: [ Select ]
 
<?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["submitvalue2"]){  
 
   $view = 1;  
   $loadsubj = 1;
   
   //$tmp_id         = $_POST["cons_id"];
   $tmp_id         = $_POST["qqid"];
   $save_mode      = $_POST["h_save_mode2"];
 
   $lecturer       = $_POST["lecturer"];
   $lec_username   = $_POST["lec_username"];
   $stud_username    = $_POST["student"];           // is username of student
   
   $conn11 = db_connect();
   $query11 = "select * from user where username='$stud_username' ";
   echo $query11;
   $result11 = $conn11->query($query11);      
   if($result11->num_rows > 0){
      $row11 = mysqli_fetch_assoc($result11);
      $student = $row11["name"];        
   }
   $subject       = $_POST["subject"];
   $c_date       = $_POST["c_date"];
   $time_from      = $_POST["time_from"];
   $time_to      = $_POST["time_to"];
   $report_comment = $_POST["comments"];      
   $bk_date       = $_POST["bk_date"];  
 
   if($_POST["rd_lock"] <> "N" and $_POST["rd_lock"] <> "Y"){
      $lockyn = "N";
   }else{
      $lockyn = $_POST["rd_lock"];
   }
         
}  
 
 
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="view_report_menu.php" title="mentor" ><span>MENTOR</span></a></li>
<li><a href="nmanagementee.php" title="mentee" ><span>MENTEE</span></a></li>
<li><a href="mentor_setting.php" title="mysetting" ><span>MY SETTING</span></a></li>
</ul>
</div>
</div>
<div class="ddcolortabsline">&nbsp;</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&#058;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&#058;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&#058;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">&nbsp;</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">&nbsp;</td>
              <td class="style1">&nbsp;</td>
              <td class="style1">&nbsp;</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-->
      <input type="checkbox" name="mentee_list[]" value="1"
 onclick="return TotalCheckboxes(this.form.elements['mentee_list[]'], total_field)"><?php echo $row["mentee"]; ?><br />
 
 <script language="javascript">
function TotalCheckboxes(grp, total)
{
    var x, sub = 0, len = grp.length;
    for (x=0; x<len; ++x) {
        if (grp[x].checked) sub += Number(grp[x].value);
           
    }
    total.value = sub;  
    return true;
}</script>      
        <?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">list</td>
              <td class="style1">:</td>
              <td class="style1">
           <?php
              if($_GET["f"]=="preview"){  
                    echo "<B>".$p_subject; ?>
              <?php
              }else{  ?>              
 
                  <input type=hidden name="submitvalue2">
                  <input type=hidden name="h_save_mode2">
                  <input type=hidden name="cons_id2">                              
                  <input name="nama_list" type="text" id="name_list" value="<?php if($_GET["f"]=="edit"){ echo $name_list; } ?>" size="30" maxlength="100" />
                  <input name="name_list" type="button" id="name_list" value="  Name List  " onClick="open_gen_list_window();"  />
                  <?php
              } ?></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 type="text" name="total_field" size="10" >
                 <!--<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">&nbsp;</td>
              <td class="style1">&nbsp;</td>
              <td class="style1">&nbsp;</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 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  <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>&nbsp;</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>
 
 
 
  1.  
  2. <?php
  3. require_once('include/session.php');
  4. require_once('include/user_auth_fns.php');
  5.  
  6. $view = 0;
  7. $aa = 0;  
  8. $cur_login = $_SESSION["username"];
  9.  
  10. if($_GET["f"]=="newform" or $_GET["f"]=="edit" or $_GET["f"]=="preview"){            // click on NEW or EDIT button
  11.    $view = 1;
  12. }
  13. if($_GET["f"]=="newform"){      // click on NEW FORM button
  14.    $save_mode = "save_new";
  15. }
  16. if($_GET["f"]=="edit"){      // click on EDIT button
  17.    /*
  18.    if($_SESSION['userlevel'] == 2 and $_GET["chklock"] == "Y"){
  19.          $view = 0; ?>
  20.          <SCRIPT LANGUAGE="Javascript">
  21.             alert('This record is locked!');
  22.          </SCRIPT> <?php      
  23.    }else{ */
  24.       $save_mode = "save_edit";
  25.       $tmp_id = $_GET["rid"];
  26.       //$rid = $_GET["rid"];
  27.      
  28.       //$rid = $_GET["rid"];
  29.       $view = 1;
  30.      
  31.       $conn3 = db_connect();
  32.       $query3 = "select * from attendance where atd_id = $tmp_id ";
  33.       $result3 = $conn3->query($query3);      
  34.      
  35.       //echo $query3;
  36.      
  37.       if($result3->num_rows >0){
  38.          $row3 = mysqli_fetch_assoc($result3);
  39.          
  40.          $lecturer       = $row3["lecturer"];  
  41.          $lec_username   = $row3["lec_username"];
  42.          $date_taken      = $row3["date_taken"];  
  43.          $list_mentee   = $row3["list_mentee"];  
  44.          $ttl_mentee      = $row3["ttl_mentee"];  
  45.          $mentee_abs      = $row3["mentee_abs"];  
  46.          $p_lockyn       = $row3["lockyn"];
  47.       }      
  48.    //}
  49. }
  50.  
  51.  
  52. if($_GET["f"]=="preview"){      // click on PREVIEW button
  53.    /*
  54.    if($_SESSION['userlevel'] == 2 and $_GET["chklock"] == "Y"){
  55.          $view = 0; ?>
  56.          <SCRIPT LANGUAGE="Javascript">
  57.             alert('This record is locked!');
  58.          </SCRIPT> <?php      
  59.    }else{ */
  60.       $rid = $_GET["rid"];
  61.       $view = 1;
  62.      
  63.       $conn3 = db_connect();
  64.       $query3 = "select * from attendance where atd_id = $rid ";
  65.       $result3 = $conn3->query($query3);      
  66.    
  67.       //echo $query3;
  68.      
  69.       if($result3->num_rows >0){
  70.          $row3 = mysqli_fetch_assoc($result3);
  71.          
  72.          $lecturer       = $row3["lecturer"];  
  73.          $lec_username   = $row3["lec_username"];
  74.          $date_taken      = $row3["date_taken"];  
  75.          $list_mentee   = $row3["list_mentee"];  
  76.          $ttl_mentee      = $row3["ttl_mentee"];  
  77.          $mentee_abs      = $row3["mentee_abs"];  
  78.          $p_lockyn       = $row3["lockyn"];
  79.          
  80.          //$p_c_date_prev = $p_c_date;
  81.       }  
  82.    //}  
  83. }
  84.  
  85.  
  86. if($_GET["f"]=="lock"){      // click on LOCK @ UNLOCK button
  87.  
  88. //echo ">>> ".$_GET["f"];
  89.  
  90.    if($_SESSION['userlevel'] == 3 or $_SESSION['userlevel'] == 2){
  91.       $rid = $_GET["rid"];
  92.       $lockyn = $_GET["locked"];
  93.       $view = 0;      
  94.      
  95.       if($lockyn == "N"){ $newlockyn = "Y"; }
  96.       if($lockyn == "Y"){ $newlockyn = "N"; }
  97.      
  98.       $conn4 = db_connect();
  99.       $query4 = "update attendance set lockyn = '$newlockyn' where atd_id = $rid ";
  100.       $result4 = $conn4->query($query4);      
  101.    
  102.       if($result4){ ?>
  103.          <SCRIPT LANGUAGE="Javascript">
  104.             alert('The change has been done!');
  105.          </SCRIPT> <?php  
  106.       }else{ ?>
  107.          <SCRIPT LANGUAGE="Javascript">
  108.             alert('The change has NOT been done!');
  109.          </SCRIPT> <?php  
  110.       }
  111.    }else{?>
  112.          <SCRIPT LANGUAGE="Javascript">
  113.             alert('Your user level has NOT access right to change the lock mode!');
  114.          </SCRIPT> <?php      
  115.    }
  116. }
  117.  
  118.  
  119. if($_GET["f"]=="delete"){      // click on DELETE button
  120.    /*
  121.    if($_SESSION['userlevel'] == 2 and $_GET["chklock"] == "Y"){
  122.          $view = 0; ?>
  123.          <SCRIPT LANGUAGE="Javascript">
  124.             alert('This record is locked!');
  125.          </SCRIPT> <?php      
  126.    }else{ */
  127.       $rid = $_GET["rid"];
  128.       $view = 0;    
  129.      
  130.       $conn5 = db_connect();
  131.       $query5 = "delete from attendance where atd_id = $rid ";
  132.       $result5 = $conn5->query($query5);      
  133.      
  134.       //echo $query5;
  135.      
  136.       if($result5){ ?>
  137.          <SCRIPT LANGUAGE="Javascript">
  138.             alert('The record has been deleted!');
  139.          </SCRIPT> <?php  
  140.       }else{ ?>
  141.          <SCRIPT LANGUAGE="Javascript">
  142.             alert('The record has NOT been deleted!');
  143.          </SCRIPT> <?php  
  144.       }
  145.    //}
  146. }
  147.  
  148. if($_POST["submitvalue2"]){  
  149.  
  150.    $view = 1;  
  151.    $loadsubj = 1;
  152.    
  153.    //$tmp_id         = $_POST["cons_id"];
  154.    $tmp_id         = $_POST["qqid"];
  155.    $save_mode      = $_POST["h_save_mode2"];
  156.  
  157.    $lecturer       = $_POST["lecturer"];
  158.    $lec_username   = $_POST["lec_username"];
  159.    $stud_username    = $_POST["student"];           // is username of student
  160.    
  161.    $conn11 = db_connect();
  162.    $query11 = "select * from user where username='$stud_username' ";
  163.    echo $query11;
  164.    $result11 = $conn11->query($query11);      
  165.    if($result11->num_rows > 0){
  166.       $row11 = mysqli_fetch_assoc($result11);
  167.       $student = $row11["name"];        
  168.    }
  169.    $subject       = $_POST["subject"];
  170.    $c_date       = $_POST["c_date"];
  171.    $time_from      = $_POST["time_from"];
  172.    $time_to      = $_POST["time_to"];
  173.    $report_comment = $_POST["comments"];      
  174.    $bk_date       = $_POST["bk_date"];  
  175.  
  176.    if($_POST["rd_lock"] <> "N" and $_POST["rd_lock"] <> "Y"){
  177.       $lockyn = "N";
  178.    }else{
  179.       $lockyn = $_POST["rd_lock"];
  180.    }
  181.          
  182. }  
  183.  
  184.  
  185. if($_POST['submitvalue1']){
  186.  
  187.    $view = 0;  
  188.    
  189.    $lecturer          = $_POST["lecturer"];
  190.    $lec_username      = $_POST["lec_username"];
  191.    $date_taken       = $_POST["date_taken"];
  192.    $list_mentee       = $_POST["list_mentee"];
  193.    $ttl_mentee       = $_POST["ttl_mentee"];
  194.    $mentee_abs       = $_POST["mentee_abs"];
  195.    $atd_adddte         = date('Y-m-d');
  196.  
  197.    if($mentee_abs < 0 or $ttl_mentee < 0){?>
  198.       <SCRIPT LANGUAGE="Javascript">
  199.          alert('Minimun value of attendance is zero!');
  200.       </SCRIPT> <?php      
  201.    }else{
  202.    
  203.       if($mentee_abs > $ttl_mentee){ ?>
  204.             <SCRIPT LANGUAGE="Javascript">
  205.                alert('Number of absence is MORE than total mentee!');
  206.             </SCRIPT> <?php  
  207.       }else{
  208.    
  209.          if($_POST["rd_lock"] <> "N" and $_POST["rd_lock"] <> "Y"){
  210.             $lockyn = "N";
  211.          }else{
  212.             $lockyn = $_POST["rd_lock"];
  213.          }
  214.            
  215.          $conn = db_connect();      
  216.          
  217.    
  218.    
  219.          if($_POST["h_save_mode"]=="save_edit"){
  220.             $rid = $_POST["cons_id"];
  221.             $chk_remaindte = $_POST["chk_remaindte"];  // determine to update the DATE field      
  222.            
  223.             if($chk_remaindte == 1){  // NOT update
  224.      
  225.                   if($_SESSION['userlevel'] == 3){
  226.                      $query = " update attendance set ".
  227.                               " lecturer         = '$lecturer', ".
  228.                               " lec_username      = '$lec_username', ".
  229.                               //" date_taken      = '$date_taken', ".
  230.                               " list_mentee      = '$list_mentee', ".
  231.                               " ttl_mentee      = '$ttl_mentee', ".
  232.                               " mentee_abs      = '$mentee_abs', ".      
  233.                               " lockyn          = '$lockyn' ".  
  234.                             " where atd_id = $rid ";
  235.                   }else{
  236.                      $query = " update attendance set ".
  237.                               " lecturer         = '$lecturer', ".
  238.                               " lec_username      = '$lec_username', ".
  239.                               //" date_taken      = '$date_taken', ".
  240.                               " list_mentee      = '$list_mentee', ".
  241.                               " ttl_mentee      = '$ttl_mentee', ".
  242.                               " mentee_abs      = '$mentee_abs', ".
  243.                               " lockyn          = '$lockyn' ".  
  244.                             " where atd_id = $rid ";  
  245.                   }
  246.            
  247.             }else{                 // update
  248.      
  249.                   if($_SESSION['userlevel'] == 3){
  250.                      $query = " update attendance set ".
  251.                               " lecturer         = '$lecturer', ".
  252.                               " lec_username      = '$lec_username', ".
  253.                               " date_taken      = '$date_taken', ".
  254.                               " list_mentee      = '$list_mentee', ".
  255.                               " ttl_mentee      = '$ttl_mentee', ".
  256.                               " mentee_abs      = '$mentee_abs', ".      
  257.                               " lockyn          = '$lockyn' ".  
  258.                             " where atd_id = $rid ";
  259.                   }else{
  260.                      $query = " update attendance set ".
  261.                               " lecturer         = '$lecturer', ".
  262.                               " lec_username      = '$lec_username', ".
  263.                               " date_taken      = '$date_taken', ".
  264.                               " list_mentee      = '$list_mentee', ".
  265.                               " ttl_mentee      = '$ttl_mentee', ".
  266.                               " mentee_abs      = '$mentee_abs', ".
  267.                               " lockyn          = '$lockyn' ".  
  268.                             " where atd_id = $rid ";  
  269.                   }      
  270.             }
  271.                            
  272.             //echo $query;
  273.             $result = $conn->query($query);
  274.            
  275.             if(!$result){ ?>
  276.                <SCRIPT LANGUAGE="Javascript">
  277.                   alert('Update form is fail!');
  278.                </SCRIPT> <?php        
  279.             }else{ ?>
  280.                <SCRIPT LANGUAGE="Javascript">
  281.                   alert('Update form is success!');
  282.                </SCRIPT> <?php
  283.             }                            
  284.          }
  285.    
  286.          if($_POST["h_save_mode"]=="save_new"){
  287.             $query = "insert into attendance ".
  288.                    "(lecturer,lec_username,date_taken,list_mentee,ttl_mentee,mentee_abs,atd_adddte,lockyn) values ".
  289.                    "('$lecturer','$lec_username','$date_taken','$list_mentee','$ttl_mentee','$mentee_abs','$atd_adddte','$lockyn') ";
  290.             $result = $conn->query($query);
  291.            
  292.             //echo $query;
  293.            
  294.             if(!$result){ ?>
  295.                <SCRIPT LANGUAGE="Javascript">
  296.                   alert('Submission attendance form is fail!');
  297.                </SCRIPT> <?php
  298.             }else{?>
  299.                <SCRIPT LANGUAGE="Javascript">
  300.                   alert('Submission attendance form is success!');
  301.                </SCRIPT> <?php
  302.             }  
  303.          }
  304.       }
  305.    }
  306. }
  307.  
  308. $conn2 = db_connect();
  309. $query2 = "select * from attendance where lec_username='$cur_login' ";
  310. $result2 = $conn2->query($query2);  
  311.  
  312.  
  313. /* if($_POST["Go"]){
  314.  
  315.    $u_mentee_list = $_POST['mentee_list'];
  316.    $u_mentor = $_POST['mentor'];
  317.    
  318.    $conn = db_connect();
  319.  
  320.    $query1 = "select * from user where username = '$u_mentor'  ";
  321.    $result1 = $conn->query($query1);  
  322.    if($result1->num_rows > 0){
  323.       $row1 = mysqli_fetch_assoc($result1);  
  324.       $name_mentor = $row1["name"];
  325.    }
  326.    
  327.    if( is_array($u_mentee_list)){
  328.       while (list ($key, $u_mentee) = each ($u_mentee_list)) {
  329.          $query = "select * from user where username = '$u_mentee'  ";
  330.          $result = $conn->query($query);
  331.          if($result->num_rows > 0){
  332.             $row = mysqli_fetch_assoc($result);  
  333.             $name_mentee = $row["name"];
  334.          }        
  335.                
  336.          //$query2 = "update mentormentee set mentor= '$name_mentor' , username_mentor= '$u_mentor'  WHERE username_mentee='$u_mentee' ";
  337.          //$result2 = $conn->query($query2);                  
  338.       }
  339.    }            
  340. } */
  341.  
  342. ?>
  343.  
  344.  
  345.  
  346. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  347. <html xmlns="http://www.w3.org/1999/xhtml">
  348.  
  349. <head>
  350. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  351.  
  352. <title>Untitled Document</title>
  353. <script LANGUAGE="JavaScript">
  354. <!--
  355. // Nannette Thacker http://www.shiningstar.net
  356. function confirmSubmit()
  357. {
  358. var agree=confirm("Are you sure you wish to continue?");
  359. if (agree)
  360.    return true ;
  361. else
  362.    return false ;
  363. }
  364. // -->
  365. </script>
  366.  
  367.  
  368. <script type="text/javascript" src="calendarDateInput.js">
  369.  
  370. /***********************************************
  371. * Jason's Date Input Calendar- By Jason Moon http://calendar.moonscript.com/dateinput.cfm
  372. * Script featured on and available at http://www.dynamicdrive.com
  373. * Keep this notice intact for use.
  374. ***********************************************/
  375.  
  376. </script>
  377. <script language="JavaScript" type="text/JavaScript">
  378. <!--
  379. function MM_preloadImages() { //v3.0
  380.   var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
  381.     var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
  382.     if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
  383. }
  384.  
  385. function MM_swapImgRestore() { //v3.0
  386.   var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
  387. }
  388.  
  389. function MM_findObj(n, d) { //v4.01
  390.   var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
  391.     d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  392.   if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  393.   for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  394.   if(!x && d.getElementById) x=d.getElementById(n); return x;
  395. }
  396.  
  397. function MM_swapImage() { //v3.0
  398.   var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
  399.    if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
  400. }
  401. //-->
  402. </script>
  403.  
  404.  
  405. <script type="text/javascript">
  406. <!--
  407. ddaccordion.init({
  408.    headerclass: "submenuheader", //Shared CSS class name of headers group
  409.    contentclass: "submenu", //Shared CSS class name of contents group
  410.    revealtype: "click", //Reveal content when user clicks or onmouseover the header? Valid value: "click" or "mouseover
  411.    mouseoverdelay: 200, //if revealtype="mouseover", set delay in milliseconds before header expands onMouseover
  412.    collapseprev: true, //Collapse previous content (so only one open at any time)? true/false
  413.    defaultexpanded: [], //index of content(s) open by default [index1, index2, etc] [] denotes no content
  414.    onemustopen: false, //Specify whether at least one header should be open always (so never all headers closed)
  415.    animatedefault: false, //Should contents open by default be animated into view?
  416.    persiststate: true, //persist state of opened contents within browser session?
  417.    toggleclass: ["", ""], //Two CSS classes to be applied to the header when it's collapsed and expanded, respectively ["class1", "class2"]
  418.    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)
  419.    animatespeed: "fast", //speed of animation: integer in milliseconds (ie: 200), or keywords "fast", "normal", or "slow"
  420.    oninit:function(headers, expandedindices){ //custom code to run when headers have initalized
  421.       //do nothing
  422.    },
  423.    onopenclose:function(header, index, state, isuseractivated){ //custom code to run whenever a header is opened or closed
  424.       //do nothing
  425.    }
  426. })
  427.  
  428. //-->
  429. </script>
  430.  
  431. <script language="JavaScript" type="text/JavaScript">
  432. <!--
  433. function MM_swapImgRestore() { //v3.0
  434.   var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
  435. }
  436.  
  437. function MM_preloadImages() { //v3.0
  438.   var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
  439.     var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
  440.     if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
  441. }
  442.  
  443. function MM_findObj(n, d) { //v4.01
  444.   var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
  445.     d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  446.   if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  447.   for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  448.   if(!x && d.getElementById) x=d.getElementById(n); return x;
  449. }
  450.  
  451. function MM_swapImage() { //v3.0
  452.   var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
  453.    if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
  454. }
  455. //-->
  456. </script>
  457.  
  458. <link href= "2col_leftNav1.css" rel="stylesheet" type="text/css" />
  459. <link href= "pink_menu_left.css" rel="stylesheet" type="text/css" />
  460.  
  461. <link href="dropdowntabfiles/ddcolortabs.css" rel="stylesheet" type="text/css" />
  462. <link href="dropdowntabfiles/dropdowntabs.js" rel="stylesheet" type="text/css" />
  463.  
  464. <style type="text/css">
  465. <!--
  466. .style2 {color: #FF0000}
  467. -->
  468. </style>
  469. </head>
  470.  
  471. <body onLoad="MM_preloadImages('image/images/pre_icon_03.gif','image/images/edit_icon_03.gif','image/images/delete_icon_03.gif')">
  472.  
  473. <div id="masthead">
  474.  
  475.    <div align="left"></div>
  476. </div>
  477.  
  478.   <div id="masthead_1">
  479.   <table width="300" border="0" align="right">
  480.   <tr>
  481.     <td bgcolor="#CCCCCC"><font class=label face="Verdana" size="2"><?php echo $_SESSION["name"]; ?> | time |<a href="nlogout.php"> Logout</a>   </font></td>
  482.   </tr>
  483. </table>
  484. <div id="colortab_1">
  485. <div id="colortab" class="ddcolortabs">
  486. <ul>
  487. <li><a href="nprofile1.php" title="profile" ><span>PROFILE</span></a></li>
  488. <li><a href="nforms.php" title="froms" ><span>FORMS</span></a></li>
  489. <li><a href="view_report_menu.php" title="mentor" ><span>MENTOR</span></a></li>
  490. <li><a href="nmanagementee.php" title="mentee" ><span>MENTEE</span></a></li>
  491. <li><a href="mentor_setting.php" title="mysetting" ><span>MY SETTING</span></a></li>
  492. </ul>
  493. </div>
  494. </div>
  495. <div class="ddcolortabsline">&nbsp;</div>
  496. <!--1st drop down menu -->                                                  
  497. <div id="dropmenu1_a" class="dropmenudiv_a">
  498. <a href="./?pg=consult">Consultation</a>
  499. <a href="./?pg=activity">Activity</a>
  500. <a href="discussion.html">Discussion</a>
  501. <a href="">Attendance</a></div>
  502. <!--2nd drop down menu -->                                              
  503. <div id="dropmenu2_a" class="dropmenudiv_a" style="width: 150px;">
  504. <a href="javascript&#058;load()">Update</a>
  505. <a href="">Preview</a>
  506. <a href="">Save</a></div>
  507.  
  508.   </div>
  509. <div id="content">
  510.   <div class="story"><form name="form" id="form" method="post" action="a2.php">
  511.      <table width="741" border="0">
  512.         <tr>
  513.           <td width="735"><table width="884" border="0" align="left">
  514.             <tr>
  515.               <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">
  516.                 <input type=hidden name="h_save_mode">
  517.                 <input type=hidden name="cons_id">
  518.                 <input type=hidden name="bk_date">
  519.                     <a <?php if($view==1){ ?> href="javascript&#058;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&#058;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>
  520.               <td width="13">&nbsp;</td>
  521.             </tr>
  522.           </table></td>
  523.         </tr>
  524.         <tr>
  525.           <td><table width="884" class="style1" height="20" border="0" align="left">
  526.             <tr> </tr>
  527.             <tr>
  528.               <td width="51" bgcolor="#FFD9D9" class="style1"><div align="center" class="style13">
  529.                   <div align="center"><span class="style12">No</span></div>
  530.               </div></td>
  531.               <td width="350" bgcolor="#FFD9D9" class="style1"><div align="center" class="style13"><span class="style12">Date</span></div></td>
  532.               <td colspan="2" bgcolor="#FFD9D9" class="style1"><div align="center" class="style13"><span class="style12">Action</span></div></td>
  533.             </tr>
  534.             <tr>
  535.               <?php
  536.          while ($row2 = mysqli_fetch_assoc($result2)){
  537.          $aa = $aa + 1;
  538.          ?>
  539.               <td height="27" class="style1"><?php echo $aa; ?>
  540.                   <div align="center"></div>
  541.                 <div align="center"></div></td>
  542.               <td class="style1"><?php echo $row2["date_taken"]; ?></td>
  543.               <td class="style1"><div align="center">
  544.                   <?php
  545.                //$tmp_id = $row2["rid"];
  546.                //echo ">>>tmp_id: ".$tmp_id;
  547.                ?>
  548.                 <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>
  549.                   <table border="0" cellpadding="0" cellspacing="0">
  550.                     <tr>
  551.                       <td></td>
  552.                     </tr>
  553.                 </table></td>
  554.             </tr>
  555.             <?php } ?>
  556.           </table></td>
  557.         </tr>
  558.         <tr>
  559.           <td height="356">
  560.          <?php          
  561.          if($view == 1) { ?>
  562.          <table width="69%" border="0" align="center" cellpadding="2" cellspacing="2" bordercolor="#111111" id="AutoNumber2" style="border-collapse: collapse">
  563.             <tr valign="top">
  564.               <td width="161" height="26" align=left class="style1"><font class=label face="Verdana" size="2">Name of Lecturer </font></td>
  565.               <td width="13" class="style1"><font class=label face="Verdana" size="2">:</font></td>
  566.               <td width="469" class="style1"><font face="Verdana">
  567.               <?php
  568.               if($_GET["f"]=="preview"){  
  569.                     echo "<B>".$lecturer; ?>
  570.               <?php
  571.               }else{ ?>          
  572.                 <input name="lecturer" type="text" id="lecturer" value="<?php echo $_SESSION["name"]; ?>" readonly/>
  573.                 <input name="lec_username" type="hidden" id="lec_username" value="<?php echo $_SESSION["username"]; ?>">
  574.                <?php
  575.               } ?>            
  576.               </font><font size="2" face="Verdana"> </font></td>
  577.             </tr>
  578.             <tr valign="top">
  579.               <td height="26" align=left class="style1"><font size="2" face="Verdana">Date</font></td>
  580.               <td width="13" class="style1"><font class=label face="Verdana" size="2">:</font></td>
  581.               <td class="style1">
  582.               <?php
  583.               if($_GET["f"]=="preview"){  
  584.                     echo "<B>".$date_taken; ?>
  585.               <?php
  586.               }else{
  587.                if($_GET["f"]=="edit"){  
  588.                   //$p_c_date_prev = $p_c_date;   ?>          
  589.             <script>
  590.                   //DateInput('c_date', true, 'YYYY-MM-DD', <?php if($_GET["f"]=="edit"){ echo $p_c_date; } ?>)
  591.                   DateInput('date_taken', true, 'YYYY-MM-DD')
  592.                   </script> <?php
  593.                }else{
  594.                     ?>                    
  595.                   <script>
  596.                   //DateInput('c_date', true, 'YYYY-MM-DD', <?php if($_GET["f"]=="edit"){ echo $p_c_date; } ?>)
  597.                   DateInput('date_taken', true, 'YYYY-MM-DD')
  598.                   </script>
  599.                   <?php
  600.                  }
  601.               }?>
  602.              
  603.               <?php if($_GET["f"]=="edit"){ ?>                            
  604.                         <input name="chk_remaindte" type="checkbox" id="chk_remaindte" value="1" />
  605.                         <span class="style14 style2">Check this if do NOT want to update the DATE field. </span>
  606.                         <?php } ?>              </td>
  607.             </tr>
  608.             <tr valign="top">
  609.               <td height="23" align="left" class="style1">&nbsp;</td>
  610.               <td class="style1">&nbsp;</td>
  611.               <td class="style1">&nbsp;</td>
  612.             </tr>
  613.             <tr valign="top">
  614.               <td height="23" align="left" class="style1"><font face="Verdana" size="2"><font class=label>Name List Of Mentee</font></font></td>
  615.               <td width="13" class="style1"><font face="Verdana" size="2"><font class=label>:</font></font> </td>
  616.               <td class="style1"><font face="Verdana">
  617.                 <?php
  618.               if($_GET["f"]=="preview"){  
  619.                     echo "<B>".$list_mentee; ?>
  620.                 <?php
  621.               }else{ ?>
  622.                  <!--<textarea name="list_mentee" cols="40" rows="5" class="textbox" id="list_mentee"><?php echo $list_mentee; ?> </textarea> -->
  623.              <?php    
  624.        $conn = db_connect();    
  625.           $query = "SELECT * FROM mentormentee where username_mentor = '$cur_login'";
  626.      
  627.         $result = $conn->query($query);
  628.                  
  629.         while($row = mysqli_fetch_assoc($result)){ ?>
  630.    <!--<input name="mentee_list[]" type="checkbox" ><?php echo $row["mentee"]; ?><br />-->
  631.       <!--<input name="mentee_list[]" type="checkbox" value="1" multiple="multiple" option><?php echo $row["mentee"]; ?><br /></option>-->
  632.       <!--from net-->
  633.       <input type="checkbox" name="mentee_list[]" value="1"
  634.  onclick="return TotalCheckboxes(this.form.elements['mentee_list[]'], total_field)"><?php echo $row["mentee"]; ?><br />
  635.  
  636.  <script language="javascript">
  637. function TotalCheckboxes(grp, total)
  638. {
  639.     var x, sub = 0, len = grp.length;
  640.     for (x=0; x<len; ++x) {
  641.         if (grp[x].checked) sub += Number(grp[x].value);
  642.            
  643.     }
  644.     total.value = sub;  
  645.     return true;
  646. }</script>      
  647.         <?php
  648.       } ?>
  649.     </select>
  650.                 <?php
  651.               } ?>
  652.                 <label><a href="php_doc_xls_gen.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image9','','image/images/delete_icon_03.gif',1)"></a></label>
  653.               </font></td>
  654.             </tr>
  655.             <tr valign="top">
  656.               <td height="26" align=left class="style1">list</td>
  657.               <td class="style1">:</td>
  658.               <td class="style1">
  659.            <?php
  660.               if($_GET["f"]=="preview"){  
  661.                     echo "<B>".$p_subject; ?>
  662.               <?php
  663.               }else{  ?>              
  664.  
  665.                   <input type=hidden name="submitvalue2">
  666.                   <input type=hidden name="h_save_mode2">
  667.                   <input type=hidden name="cons_id2">                              
  668.                   <input name="nama_list" type="text" id="name_list" value="<?php if($_GET["f"]=="edit"){ echo $name_list; } ?>" size="30" maxlength="100" />
  669.                   <input name="name_list" type="button" id="name_list" value="  Name List  " onClick="open_gen_list_window();"  />
  670.                   <?php
  671.               } ?></td>
  672.             </tr>
  673.             <tr valign="top">
  674.               <td height="26" align=left class="style1"><font face="Verdana" size="2"><font class=label>Total Mentee</font></font></td>
  675.               <td class="style1"><font class=label face="Verdana" size="2">:</font></td>
  676.               <td class="style1"><FONT face=Verdana>
  677.               <?php
  678.               if($_GET["f"]=="preview"){  
  679.                     echo "<B>".$ttl_mentee; ?>
  680.               <?php
  681.               }else{ ?>  
  682.                  
  683.               <input type="text" name="total_field" size="10" >
  684.                  <!--<INPUT name="ttl_mentee" class=textbox id="ttl_mentee" size=10 maxLength=5 value="<?php echo $total; ?>">-->    
  685.                 <!--<INPUT name="ttl_mentee" class=textbox id="ttl_mentee" size=10 maxLength=5 value="<?php echo $ttl_mentee; ?>">
  686.             <INPUT name="ttl_mentee" class=textbox id="ttl_mentee" size=10 maxLength=5 value="<?php echo $c; ?>" />-->
  687.             <?php
  688.               } ?>            
  689.               </FONT></td>
  690.             </tr>
  691.             <tr valign="top">
  692.               <td height="26" align=left class="style1"><font size="2" face="Verdana">Mentee Absance</font></td>
  693.               <td class="style1"><font class=label face="Verdana" size="2">:</font></td>
  694.               <td class="style1"><font face=Verdana>
  695.               <?php
  696.               if($_GET["f"]=="preview"){  
  697.                     echo "<B>".$mentee_abs; ?>
  698.               <?php
  699.               }else{ ?>            
  700.                 <input name="mentee_abs" class=textbox id="mentee_abs" size=10 maxlength=5 value="<?php echo $mentee_abs; ?>">
  701.             <?php
  702.               } ?>            
  703.               </font><font size="2" face="Verdana"> </font></td>
  704.             </tr>
  705.             <tr valign="top">
  706.               <td height="26" align=left class="style1">&nbsp;</td>
  707.               <td class="style1">&nbsp;</td>
  708.               <td class="style1">&nbsp;</td>
  709.             </tr>
  710.          
  711.          <?php if($_SESSION["userlevel"] == 3 or $_SESSION['userlevel'] == 2 or $_GET["f"]=="preview"){ ?>
  712.             <tr valign="top">
  713.               <td height="23" colspan="3" align="left" class="style1">
  714.                 <?php
  715.                  if($_GET["f"]=="preview"){
  716.                   if($p_lockyn == "Y"){
  717.                      echo "<B>"."<font color=red>"."*** LOCK ***";
  718.                   }else{
  719.                      echo "<B>"."<font color=red>"."*** UNLOCK ***";
  720.                   }  
  721.                  }else{ ?>
  722.                 <input name="rd_lock" type="radio" value="N" <?php if($p_lockyn == "N"){ ?>checked="checked" <?php } ?>  />
  723.   Unlock &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  724.   <input name="rd_lock" type="radio" value="Y" <?php if($p_lockyn == "Y"){ ?>checked="checked" <?php } ?>  />
  725.   Lock
  726.   <?php
  727.                  } ?>              </td>
  728.               </tr>
  729.            <?php } ?>
  730.             <tr valign="top">
  731.               <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">
  732.               </table>            </tr>
  733.           </table>
  734.         <? } ?>   </td>
  735.         </tr>
  736.       </table>
  737.      <p>&nbsp;</p>
  738. </form>
  739. <script>
  740. function rem() {
  741.    document.getElementById('form').submitvalue1.value="1";
  742.    document.getElementById('form').h_save_mode.value="<?php echo $save_mode; ?>";  
  743.    document.getElementById('form').cons_id.value="<?php echo $tmp_id; ?>";
  744. //   document.getElementById('form').bk_date.value="<?php echo $p_c_date_prev; ?>";
  745.    document.getElementById('form').submit();
  746. }
  747. </script>
  748.  
  749. </div>
  750.   <div id="breadCrumb_1"></div>
  751. </div>
  752.  
  753. <div id="navBar">
  754.   <div id="search"></div>
  755.  
  756.   <div class="relatedLinks">
  757.      <h3> <div class="glossymenu">
  758.     <a href="#"  class="menuitem">Attendance</a></div> </h3>
  759.   </div>
  760. </div>
  761. </body>
  762. </html>
  763.  
  764.  
  765.  
  • Bogey
  • Genius
  • Genius
  • Bogey
  • Posts: 8416
  • Loc: USA

Post 3+ Months Ago

Try this... this is my first attempt at Javascript so... bare with me :)
JAVASCRIPT Code: [ Select ]
function popup(text) {
   if (confirm(text))
   {
      if(!document.form.submit())
      {
         alert('There was a problem submitting the form.');
      }
   }
   else
   {
      // Do something here... like redirect user to some place
   }
}
  1. function popup(text) {
  2.    if (confirm(text))
  3.    {
  4.       if(!document.form.submit())
  5.       {
  6.          alert('There was a problem submitting the form.');
  7.       }
  8.    }
  9.    else
  10.    {
  11.       // Do something here... like redirect user to some place
  12.    }
  13. }

And the HTML for that would be
HTML Code: [ Select ]
<form method="post" action="jscript_process.php" name="form" onSubmit="popup('Are you sure?');">
Some text: <input type="text" size="45" /><br />
<input type="submit" name="submit" value="Click Here">
</form>
  1. <form method="post" action="jscript_process.php" name="form" onSubmit="popup('Are you sure?');">
  2. Some text: <input type="text" size="45" /><br />
  3. <input type="submit" name="submit" value="Click Here">
  4. </form>

Well, the only problem with it (at least for me) is that it is opening the download box for the process... it doesn't actually go there and do the process :(

Maybe someone here would give an answer or solution as to how to fix that...

Post Information

  • Total Posts in this topic: 2 posts
  • Users browsing this forum: No registered users and 21 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.