1,105,546 Community Members

Rekod Kehadiran

Member Avatar
afidah
Newbie Poster
8 posts since Aug 2010
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

hello....anybody can help me?
acctually,now i'm doing some php system...
i create Sistem Kehadiran...
but it can record one time only...
can anybody help me?
This is coding of my system...

rekod2.php:

<!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=utf-8" />
<title>Untitled Document</title>
</head>

<body>


<?php
include 'db_connect.php';
$query1="SELECT * FROM users,tindakan WHERE users.id=tindakan.id_user ORDER BY Nama ";
$result1=mysql_query($query1);
$query="SELECT * FROM users  ORDER BY Nama ";
$result=mysql_query($query);
$list=mysql_num_rows(mysql_query("SELECT * FROM tindakan"));

$row=mysql_num_rows($result);
$row=$row-$list;
if(isset($_POST['save'])){

    $count=0;
    $num=0;

    while($count < $row ){
        if($_POST['kehadiran'.$count]!=""){
            $id=explode("+",$_POST['kehadiran'.$count]);
            $kehadiran[$num]=$id[0];
            $ids[$num]=$id[1];
        $num+=1;    

        }

        $count+=1;
    }
    $count=0;

    while($count < $num){
        $count."<br>";
        $tindakan=$kehadiran[$count];
        $id=$ids[$count];
    $Q="insert into tindakan (id_user,tindak) values($id,'$tindakan')";
    $R=mysql_query($Q);
    $count+=1;
    }
    ?><script>window.location="test_view.php";</script><?php
}
?>
<p align="center" style="text-transform:capitalize; color:#0C0; font-size:24px; font-weight:700">REKOD KEDATANGAN PELAJAR</p><br />
<hr width="70%" /><br />
<table width="989" border="1" align="center" cellpadding="2" cellspacing="0">
<tr bgcolor="#CCFFCC" style="font-weight:600">
<td width="25" align="center">BIL</td><td width="279" align="center">Nama</td><td width="148" align="center">Kad Pengenalan</td><td width="285" align="center">Institut Pengajian</td><td align="center" colspan="2">Tindakan</td>
</tr><form id="form1" name="form1" method="post" action="">
<?php
$i=1;
 while($record = mysql_fetch_array($result))
    {
        if($r=mysql_query("SELECT * FROM tindakan WHERE id_user=".$record['id'])){
        $list=mysql_num_rows($r);
        }

        if($list==0){
?>

        <tr>
          <td height="28" class="style1"><div align="center" class="style1 style3"><?php print $i;?></div></td>
            <td class="style1"><div align="center" class="style1 style3"><?php print $record['Nama']?></div></td>
            <td class="style1"><div align="center" class="style1 style3"><?php print $record['ic']?></div></td>
            <td class="style1"><div align="center" class="style1 style3"><?php print $record['ipt']?></div></td>

             <td width="104" align="center" class="style1">
               <label>
                 <input type="radio" name="kehadiran<?php echo $i-1; ?>" value="hadir+<?php echo $record['id']; ?>" />
                 Hadir
               </label>
           </td>

          <td width="108" align="center" class="style1">
            <label>
              <input type="radio" name="kehadiran<?php echo $i-1; ?>" value="Tidak Hadir+<?php echo $record['id']; ?>" />
            </label>
            Tidak Hadir


                  </td>
          </tr>
        <?php

        $i++;
        }

  }

  ?>
  <tr><td bgcolor="#CCFFCC" colspan="6" align="center"><input type="submit" name="save" value="SIMPAN"></td></tr>
  </form>
</table>
</body>
</html>

test_view.php :

<?php
include 'db_connect.php';
$query1="SELECT * FROM users,tindakan WHERE users.id=tindakan.id_user ORDER BY Nama ";
$result1=mysql_query($query1);
$query="SELECT * FROM users  ORDER BY Nama ";
$result=mysql_query($query);
$list=mysql_num_rows(mysql_query("SELECT * FROM tindakan"));

$row=mysql_num_rows($result);
$row=$row-$list;
if(isset($_POST['save'])){

    $count=0;
    $num=0;

    while($count < $row ){
        if($_POST['kehadiran'.$count]!=""){
            $id=explode("+",$_POST['kehadiran'.$count]);
            $kehadiran[$num]=$id[0];
            $ids[$num]=$id[1];
        $num+=1;    

        }

        $count+=1;
    }
    $count=0;

    while($count < $num){
        $count."<br>";
        $tindakan=$kehadiran[$count];
        $id=$ids[$count];
    $Q="insert into tindakan (id_user,tindak) values($id,'$tindakan')";
    $R=mysql_query($Q);
    $count+=1;
    }
    ?><script>window.location="rekod3.php";</script><?php
}
?>
<table border="1" cellspacing="0" cellpadding="1" align="center">
<tr bgcolor="#CCFFCC" style="font-weight:600">
<td width="25" align="center">BIL</td><td width="279" align="center">Nama</td><td width="148" align="center">Kad Pengenalan</td><td width="285" align="center">Institut Pengajian</td><td align="center">Tindakan</td>
</tr>
<?php

$i=1;
 while($record1 = mysql_fetch_array($result1))
    {
?>
        <tr>
          <td height="28" class="style1"><div align="center" class="style1 style3"><?php print $i;?></div></td>
            <td class="style1"><div align="center" class="style1 style3"><?php print $record1['Nama']?></div></td>
            <td class="style1"><div align="center" class="style1 style3"><?php print $record1['ic']?></div></td>
            <td class="style1"><div align="center" class="style1 style3"><?php print $record1['ipt']?></div></td>

             <td width="104" align="center" class="style1">
               <?php print $record1['tindak']?>
           </td>
          </tr>
        <?php
        $i++;

  }

  ?>
</table><br />
 <tr>


  </form>
</table>
</body>
</html>
Member Avatar
HasNor
Junior Poster
101 posts since Jan 2012
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Hi, sorry..actually what you means for one time? is it update data issue? not clear about the problem..

Member Avatar
afidah
Newbie Poster
8 posts since Aug 2010
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

sorry...acctually i want to display back the record page..then i want to record again to the next day..
i want to display student's presence every day...how to do it?are u clear...sory again..
acctually i'm new in php..

Member Avatar
diafol
Where are my eyes?
13,004 posts since Oct 2006
Reputation Points: 1,821 [?]
Q&As Helped to Solve: 1,850 [?]
Skill Endorsements: 92 [?]
Moderator
Featured
Sponsor
 
0
 

You want an attendance register?

Member Avatar
afidah
Newbie Poster
8 posts since Aug 2010
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

something like that...

You
This article has been dead for over three months: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article