> For the complete documentation index, see [llms.txt](https://dhrubo.gitbook.io/programming-with-js/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://dhrubo.gitbook.io/programming-with-js/result-management-system-project-3/mark-crud.md).

# Mark CRUD

1\.

```php
<!DOCTYPE html>
<html>
<head>
	<title>Input Student Marks</title>
</head>
<body>
	<h1>Input Student Marks</h1>
	<form method="post" action="save_marks.php">
		<label for="student_id">Student ID:</label>
		<input type="text" id="student_id" name="student_id" required>
		<br><br>
		<label for="subject_id">Subject ID:</label>
		<input type="text" id="subject_id" name="subject_id" required>
		<br><br>
		<label for="type">Type:</label>
		<select id="type" name="type">
			<option value="compulsory">Compulsory</option>
			<option value="optional">Optional</option>
		</select>
		<br><br>
		<label for="marks_obtained">Marks Obtained:</label>
		<input type="text" id="marks_obtained" name="marks_obtained" required>
		<br><br>
		<label for="total_marks">Total Marks:</label>
		<input type="text" id="total_marks" name="total_marks" required>
		<br><br>
		<input type="submit" value="Save Marks">
	</form>
</body>
</html>
```

2\.

```php
<?php
// Include the database connection file
require_once 'db_connect.php';

// Get the form data
$student_id = $_POST['student_id'];
$subject_id = $_POST['subject_id'];
$type = $_POST['type'];
$marks_obtained = $_POST['marks_obtained'];
$total_marks = $_POST['total_marks'];

// Prepare the SQL statement
$sql = "INSERT INTO results (student_id, subject_id, type, marks_obtained, total_marks) VALUES (?, ?, ?, ?, ?)";

// Bind the parameters and execute the statement
$stmt = $conn->prepare($sql);
$stmt->bind_param("iisdd", $student_id, $subject_id, $type, $marks_obtained, $total_marks);
$stmt->execute();

// Redirect back to the form
header("Location: input_mark_form.php");
exit;
?>
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://dhrubo.gitbook.io/programming-with-js/result-management-system-project-3/mark-crud.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
