Please help me :)
how to do this? Student post an assignment to the supervisor.
Supervisor will receive that assignment and approve it whether click button YES or NO.
The question here is,
how to show YES or NO statement at the student page after supervisor has approved their assignment?
Thank you.

Dani AI

Generated

A simple, robust approach: record the approval in the database and let the student page read that field. was right to suggest adding a status column, and ’s question about saving status in the DB points the same way. Do not rely on plain anchor links to change state — use a server-side handler that checks the supervisor session, updates the row, and records who and when.

Schema suggestions (keeps history and makes queries easy):

  • add status TINYINT (0=pending, 1=approved, 2=rejected)
  • add approved_by INT NULL and approved_at DATETIME NULL
  • optionally status_note VARCHAR(255) for comments

Supervisor workflow (safe and minimal): render each item with a small POST form (hidden id) and two buttons (Approve / Reject). The handler validates the session/permission, uses a prepared statement to update status, approved_by, approved_at, then redirects back. Example handler sketch:

// sv_approve.php (sketch)
session_start();
// check supervisor logged in and authorized...
$id = $_POST['id'];
$status = ($_POST['action']==='approve') ? 1 : 2;
$stmt = $pdo->prepare('UPDATE data SET status = :s, approved_by = :sv, approved_at = NOW() WHERE id = :id');
$stmt->execute([':s'=>$status, ':sv'=>$_SESSION['sv_id'], ':id'=>$id]);

Student page: SELECT the status (and approved_at/approved_by if you added them) and map the numeric value to display text. Escape output with htmlspecialchars() to avoid XSS. Example mapping:

$map = [0=>'Pending', 1=>'YES', 2=>'NO'];
echo htmlspecialchars($map[$row['status']] ?? 'Pending', ENT_QUOTES, 'UTF-8');

Security and quality notes: use PDO or mysqli with prepared statements (avoid deprecated mysql_*), require POST + CSRF tokens for state changes, verify the supervisor owns/has rights over the record, log approvals, and show approver/timestamp for auditability. This keeps the UI simple and the data dependable for students.

Recommended Answers

All 7 Replies

is it enough if we just use <a href=""> only?
This is the coding,

<?php
session_start();


if ($_SESSION['NAME']=="") {
    echo "<script>document.location.href='index.php'</script>";
        exit;} 
$id= $_SESSION['id'];

include "code.php";

$query="SELECT student.name, student.matric, student.session, data.title, data.day, data.month, data.year, data.hour, data.minute, data.timing
FROM student 
INNER JOIN data
ON student.matric = data.matric
WHERE student.session='2013/2014'
ORDER BY student.name, data.day, data.month, data.year;";
$sql=mysql_query($query) or die("Error 1");
$rows=mysql_num_rows($sql);
?>

<!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>Student Supervision System</title>

<script type="text/javascript">
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
</script>

</head>

<body>
<p align="center">
  <img src="img/bnnr13.jpg" width="1000" height="180"></p>

  <p align="center">
    Welcome <? echo  "<b>".$_SESSION['SV_FIRST_NAME']."!</b>";?>
    </p>
<table width="1115" height="550" border="1" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td><!--<p align="right">

    Welcome <? echo  "<b>".$_SESSION['SV_FIRST_NAME']."!</b>";?>
    <br /><br /></p>-->
      <br /><div align="center">
        <?php include "sv_menu.php";?>

      </div>
      <h1 align="center"><u>Student's List</u></h1>

<table width="177" height="49" border="1" align="center">
      <tr>
        <th width="57" height="45" scope="row">Session</th>
        <td width="8" align="center">
        :
        </td>
        <td width="113">
        <form name="form" id="form">
          <select name="jumpMenu2" id="jumpMenu2" onchange="MM_jumpMenu('parent',this,0)">
            <option value="sv_student_list2.php">2013/2014</option>
            <option value="sv_student_list.php">2011/2012</option>
            <option value="sv_student_list3.php">2012/2013</option>
          </select>
        </form></td>
      </tr>
    </table>
    <br /><br />
    <table width="1005" height="277" border="1" align="center">
      <tr>
        <th width="373" align="center" scope="row">Name</th>
        <td width="129" align="center">Matric Number</td>
        <td width="146" align="center">Document's Title</td>
        <td width="109" align="center">Date Send</td>
        <td width="81" align="center">Time</td>
        <td width="127" align="center">Document Approval</td>
      </tr>

    <?
    while($row = mysql_fetch_array($sql))
    {
    $fullname = $row['name'];
    $matrik = $row['matric'];
    $title = $row['title'];
    $day = $row['day'];
    $month = $row['month'];
    $year = $row['year'];
    $hour = $row['hour'];
    $minute = $row['minute'];
    $timing = $row['timing'];
    ?>
      <tr>
        <th scope="row" align="left"><?php echo $fullname; ?>&nbsp;</th>
        <td align="center"><?php echo $matrik; ?>&nbsp;</td>
        <td align="center"><a href="sv_student_report.php">
        <a href='sv_student_report.php?stdata=<? echo $matrik;?>'><?php echo $title; ?></a>&nbsp;</td>
        <td align="center"><?php echo $day."/".$month."/".$year; ?>&nbsp;</td>
        <td align="center"><?php echo $hour.":".$minute." ".$timing; ?>&nbsp;</td>
        <td align="center">
        <a href="sv_yes.php">YES</a> / <a href="sv_no.php">NO</a></td>
      </tr>
      <? } ?>
      <tr>
        <th scope="row" align="left">&nbsp;</th>
        <td align="center">&nbsp;</td>
        <td align="center">&nbsp;</td>
        <td align="center">&nbsp;</td>
        <td align="center">&nbsp;</td>
        <td align="center">&nbsp;</td>
      </tr>
      <tr>
        <th scope="row" align="left">&nbsp;</th>
        <td align="center">&nbsp;</td>
        <td align="center">&nbsp;</td>
        <td align="center">&nbsp;</td>
        <td align="center">&nbsp;</td>
        <td align="center">&nbsp;</td>
      </tr>
      <tr>
        <th scope="row" align="left">&nbsp;</th>
        <td align="center">&nbsp;</td>
        <td align="center">&nbsp;</td>
        <td align="center">&nbsp;</td>
        <td align="center">&nbsp;</td>
        <td align="center">&nbsp;</td>
      </tr>
      <tr>
        <th scope="row" align="left">&nbsp;</th>
        <td align="center">&nbsp;</td>
        <td align="center">&nbsp;</td>
        <td align="center">&nbsp;</td>
        <td align="center">&nbsp;</td>
        <td align="center">&nbsp;</td>
      </tr>
      <tr>
        <th scope="row" align="left">&nbsp;</th>
        <td align="center">&nbsp;</td>
        <td align="center">&nbsp;</td>
        <td align="center">&nbsp;</td>
        <td align="center">&nbsp;</td>
        <td align="center">&nbsp;</td>
      </tr>
      <tr>
        <th scope="row" align="left">&nbsp;</th>
        <td align="center">&nbsp;</td>
        <td align="center">&nbsp;</td>
        <td align="center">&nbsp;</td>
        <td align="center">&nbsp;</td>
        <td align="center">&nbsp;</td>
      </tr>
      <tr>
        <th scope="row" align="left">&nbsp;</th>
        <td align="center">&nbsp;</td>
        <td align="center">&nbsp;</td>
        <td align="center">&nbsp;</td>
        <td align="center">&nbsp;</td>
        <td align="center">&nbsp;</td>
      </tr>
    </table></td>
  </tr>
</table><br />

</body>
</html>

Link "<a href" for teacher, for student just display the status.
You save the status in database I supouse ?

how can we move the status into database by using "<a href"?

I guess you must be having status or approved column in your table
you can add same column in your query and display it

SELECT student.name, student.matric, student.session, data.title, data.day, data.month, data.year, data.hour, data.minute, data.timing, data.status

that's mean I need to add data.status right?
Thanks. I'll try.
But can we use "<a href" to move the data status into database?
What method that we need use to link the data status into database?
Is it $_POST?

first you have to create page for senior to approve the record status

where they set status to approve or unapprove, all pending records

same status can be displayed to junior login.

a href is only html link. you can not achieve updation of database using html links.

YOu need to create process page as I suggested in first line of this message

post and get are 2 methods in which html form elements are submitted to post and get php arrays, which can be processed by php handler code to update database.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.