Viewing file: certificate_form.php (5.7 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<!DOCTYPE html> <html lang="en">
<?php include 'head.php';?>
<body>
<!-- ======= Header ======= --> <?php include 'menubar.php';?>
<?php include 'sidebar.php';?>
<main id="main" class="main">
<div class="pagetitle"> <h1>Dashboard</h1> <nav> <ol class="breadcrumb"> <li class="breadcrumb-item"><a href="index.html">Home</a></li> <li class="breadcrumb-item active">Dashboard</li> </ol> </nav> </div><!-- End Page Title --> <section class="section dashboard"> <?php include 'connect.php';
// Get ID from URL $keywords = isset($_GET['ID']) ? intval($_GET['ID']) : 0;
// Fetch student info $sql = "SELECT * FROM admission WHERE ID='$keywords'"; $result = mysqli_query($link, $sql);
if ($result && mysqli_num_rows($result) > 0) { while ($row = mysqli_fetch_array($result)) { $branch_id = 'INFYSYS TECHNOLOGIES COMPUTER EDUCATION (SARAIMIR, AZAMGARH, UP India)'; $student_roll_no = $row['enrollment']; $student_id = $row['ID']; $name = $row['name']; $courses = $row['course']; $photo = $row['photo']; $regDate = $row['reg_date'];
// Convert to Indian format (d-m-Y) $indianDate = date("d-m-Y", strtotime($regDate));
} mysqli_free_result($result); } else { echo "No student found!"; exit; }
// ================== AUTO GENERATE CERTIFICATE NO ================== $cno = ""; $sql_cert = "SELECT CertificateNo FROM certificate ORDER BY ID DESC LIMIT 1"; $result_cert = mysqli_query($link, $sql_cert);
if ($result_cert && mysqli_num_rows($result_cert) > 0) { $row_cert = mysqli_fetch_assoc($result_cert); $last_cno = $row_cert['CertificateNo'];
// If numeric only if (is_numeric($last_cno)) { $cno = $last_cno + 1; } else { // If format is like C1001 $prefix = preg_replace('/[0-9]/', '', $last_cno); $number = preg_replace('/[^0-9]/', '', $last_cno); $cno = $prefix . str_pad(($number + 1), strlen($number), "0", STR_PAD_LEFT); } } else { // First entry $cno = "C1001"; } // ==================================================================
// Close connection mysqli_close($link); ?>
<!-- ================== FORM ================== --> <form action="gen_certi_data.php" method="post" enctype="multipart/form-data" name="form1" id="form1"> <table width="100%" border="0" cellspacing="7" cellpadding="7" bgcolor="#FFCC66" align="left"> <tr align="left"> <td width="197">Roll_No/Registration No</td> <td width="4"> </td> <td width="480"> <input name="roll_no" type="text" id="roll_no" size="80" maxlength="80" required readonly value="<?php echo $student_roll_no; ?>" /> </td> </tr> <tr> <td>NAME</td> <td> </td> <td> <input name="name" type="text" id="name" size="80" maxlength="80" readonly value="<?php echo $name; ?>" /> </td> </tr> <tr> <td>Branch ID</td> <td> </td> <td> <input name="branchid" type="text" id="branchid" size="70" maxlength="70" readonly value="<?php echo $branch_id; ?>" /> </td> </tr> <tr> <td>Course Name</td> <td> </td> <td> <input name="course" type="text" id="course" size="60" maxlength="60" readonly value="<?php echo $courses; ?>" /> </td> </tr> <tr> <td>Photo</td> <td> </td> <td> <input name="photo" type="text" id="photo" size="60" maxlength="60" value="<?php echo $photo; ?>" /> </td> </tr> <tr> <td>Issue Date</td> <td> </td> <td> <input name="issue_date" type="text" id="issue_date" size="60" maxlength="60" value="<?php echo date('d-m-Y'); ?>" required /> </td> </tr> <tr> <td>Certificate No</td> <td> </td> <td> <input name="cno" type="text" id="cno" size="60" maxlength="60" value="<?php echo $cno; ?>" readonly /> </td> </tr> <tr> <td>Start Date</td> <td> </td> <td> <input name="start_date" type="text" id="start_date" size="60" maxlength="60" value="<?php echo $indianDate; ?>" required /> </td> </tr> <tr> <td>End Date</td> <td> </td> <td> <input name="end_date" type="text" id="end_date" size="60" maxlength="60" required /> </td> </tr> <tr> <td>Grade</td> <td> </td> <td> <input name="grade" type="text" id="grade" size="60" maxlength="60" required /> </td> </tr> </table>
<br><br>
<!-- MARKS TABLE --> <table width="100%" border="2" cellspacing="5" cellpadding="5" style="background-color: #f9f9f9;"> <tr> <th>Sr. No</th> <th>Paper Name</th> <th>Maximum Marks</th> <th>Obtained Marks</th> </tr> <?php for ($i = 1; $i <= 10; $i++) { ?> <tr> <td><?php echo $i; ?></td> <td><input name="pn<?php echo $i; ?>" type="text" size="60" /></td> <td><input name="pn<?php echo $i; ?>_total_marks" type="text" size="10" /></td> <td><input name="pn<?php echo $i; ?>_obtained_marks" type="text" size="10" /></td> </tr> <?php } ?> </table>
<br><br>
<table width="100%" border="0"> <tr> <td colspan="3" align="center"> <input type="submit" name="button" id="button" value="Submit" style="padding: 10px 30px; font-size: 16px; background-color: #339933; color: white; border: none; border-radius: 5px;" /> </td> </tr> </table> </form>
</h3>
</center>
</section>
</main><!-- End #main -->
<?php include 'footer.php';?>
</body>
</html>
|