Viewing file: test_result.php (3.82 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<!DOCTYPE html> <html lang="en">
<?php include 'head.php';?> <style> body { font-family: Arial, sans-serif; margin: 0; padding: 20px; }
h1, h2 { text-align: center; }
.branch-list { list-style-type: none; padding: 0; text-align: center; }
.branch-list li { margin: 10px 0; }
.branch-list a { text-decoration: none; color: #333; font-weight: bold; }
.branch-list a:hover { color: #4CAF50; }
/* Add more styling as needed */
table { border-collapse: collapse; border-spacing: 0; width: 100%; margin: 0 auto; border:2; }
th, td { padding: 10px; text-align: left; }
th { background-color: #04AA6D; color: white; } label, input { width: 200px; } </style> <style> body { font-family: Arial, sans-serif; margin: 0; padding: 20px; }
h1 { text-align: center; }
form { max-width: 500px; margin: 0 auto; }
label { display: block; margin-top: 10px; }
input[type="text"], input[type="date"], input[type="tel"], input[type="number"], textarea, select { width: 100%; padding: 10px; margin-bottom: 10px; border: 1px solid #ccc; border-radius: 4px; box-sizing: border-box; }
input[type="submit"] { background-color: #4CAF50; color: white; padding: 10px 20px; border: none; border-radius: 4px; cursor: pointer; float: right; }
input[type="submit"]:hover { background-color: #45a049; } </style> <body>
<!-- ======= Header ======= --> <?php include 'menubar.php';?>
<?php include 'sidebar.php';?>
<main id="main" class="main">
<?php // Database connection include 'connect.php';
// Add Record if (isset($_POST['add'])) { $roll_no = $_POST['roll_no']; $name = $_POST['name']; $father_name = $_POST['father_name']; $marks = $_POST['marks']; $section = $_POST['section'];
$sql = "INSERT INTO test_result (roll_no, name, father_name, marks, section) VALUES (?, ?, ?, ?, ?)"; $stmt = $conn->prepare($sql); $stmt->bind_param("sssis", $roll_no, $name, $father_name, $marks, $section); $stmt->execute(); }
// Delete Record if (isset($_GET['delete'])) { $roll_no = $_GET['delete']; $sql = "DELETE FROM test_result WHERE roll_no=?"; $stmt = $conn->prepare($sql); $stmt->bind_param("s", $roll_no); $stmt->execute(); } ?>
<!DOCTYPE html> <html> <head> <title>Test Result Management</title> <style> table { border-collapse: collapse; width: 80%; margin-top: 20px; } th, td { border: 1px solid #ccc; padding: 8px; text-align: center; } th { background-color: #f2f2f2; } form { margin-top: 20px; } </style> </head> <body>
<h2>Add New Test Result</h2> <form method="POST"> Roll No: <input type="text" name="roll_no" required> Name: <input type="text" name="name" required> Father Name: <input type="text" name="father_name" required> Marks: <input type="number" name="marks" required> Section: <input type="text" name="section" required> <button type="submit" name="add">Add Record</button> </form>
<h2>Test Result Records</h2> <table> <tr> <th>Roll No</th> <th>Name</th> <th>Father Name</th> <th>Marks</th> <th>Section</th> <th>Action</th> </tr> <?php $result = $conn->query("SELECT * FROM test_result ORDER BY roll_no ASC"); while ($row = $result->fetch_assoc()) { echo "<tr> <td>{$row['roll_no']}</td> <td>{$row['name']}</td> <td>{$row['classes']}</td> <td>{$row['marks']}</td> <td>{$row['section']}</td> <td><a href='?delete={$row['roll_no']}' onclick=\"return confirm('Delete this record?');\">Delete</a></td> </tr>"; } ?> </table>
</body> </html>
</main><!-- End #main -->
<?php include 'footer.php';?>
</body>
</html>
|