To create documentation for your GitHub repository regarding the Registration Form project, hereβs an outline you can follow for the README.md
file, which will serve as the documentation. It explains the purpose, setup, usage, and other relevant details for developers and users.
- β¬οΈ Installation
- π Folder Structure
- π registration_card
- π Student Results Calculator`
- π Features
- π€ Connect With me
- π License
- π§Ύ Credit
Follow these steps to set up the project locally on your machine. Prerequisites Make sure you have the following installed on your machine:
Cloning the Repository
$ git clone https://github.com/prantomollick/accessible-registration-form.git
$ cd accessible-registration-form
.
βββ README.md
βββ registration_card
βΒ Β βββ registration_form.html
βΒ Β βββ script.js
βΒ Β βββ styles.css
βββ student_result
βΒ Β βββ result.php
βββ task-1 html and css.png
- π Project Overview
- π οΈ Features
- π Repository Structure
- π Form Fields & Validation Rules
- π» Installation & Setup
- π§βπ» usage
- π§ͺ Test Cases
- π οΈ Built With
This project is a simple Registration Form built using HTML, CSS, and JavaScript. It includes form validation, accessibility features, and can send form data via a POST request to a server using the Fetch API.
The form collects user information, such as:
- Full Name
- Username
- Phone Number
- Password & Confirm Password
- Gender (Male, Female, Other)
- Client-side validation: Validates form fields, ensuring data integrity (e.g., checking email format, matching passwords, etc.).
- Accessible form design: Ensures that screen readers and keyboard navigation are properly supported.
- Real-time feedback: Provides instant validation feedback, highlighting errors as users fill in the form.
- Fetch API Integration: Sends form data via
fetch()
POST request when submitted.
.
βββ index.html # HTML structure of the registration form
βββ style.css # CSS styling for the form and page layout
βββ script.js # JavaScript for form validation and sending data via Fetch API
- Full Name: Must contain only letters (at least 2 characters).
- Username: Should be alphanumeric and at least 3 characters long.
- Email: Must follow a valid email format (e.g.,
[email protected]
). - Phone Number: Validates phone number format (only digits allowed).
- Password: Must be at least 8 characters long.
- Confirm Password: Must match the password entered.
- Gender: One of Male, Female, or Other must be selected.
To run this project locally, follow these steps:
-
Clone the repository:
git clone https://github.com/prantomollick/accessible-registration-form.git cd accessible-registration-form/registration_card
-
Open the project:
- Simply open
index.html
in your browser to view the form. - Use any local server to serve the form, such as
Live Server
(VS Code extension) or using Pythonβs Simple HTTP server:python3 -m http.server
- Simply open
-
Fetch API Setup:
- You can modify the Fetch API URL inside the
script.js
file to point to your own server for testing:fetch("https://example.com/api/register", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(formObject) });
- You can modify the Fetch API URL inside the
- Fill in the form: Provide the required information (name, username, email, etc.).
- Validation Feedback: The form will validate fields in real-time. If any field is invalid, it will display an error message under the input field.
- Submit: After filling in all the fields correctly, submit the form. The form data will be sent to the server endpoint via the Fetch API.
-
Submit Valid Data:
- Fill in all fields with valid data.
- Expected Result: The form should submit successfully and send the data to the server.
-
Submit Invalid Data:
- Leave one or more fields empty or provide invalid values (e.g., invalid email format, non-matching passwords).
- Expected Result: The form should show appropriate error messages for the invalid fields.
-
Real-Time Validation:
- Focus on an input field and type invalid data.
- Expected Result: Error message should appear when the data doesn't match validation rules.
- HTML5
- CSS3
- JavaScript (ES6+)
- Fetch API
This project is a PHP program designed to calculate student results based on marks obtained in five subjects. It validates the marks, checks for fail conditions, calculates total marks, average marks, and assigns a grade based on the average.
This project calculates the student result based on five subjects. The program includes the following:
- Mark Range Validation: Ensures marks are between 0 and 100.
- Fail Condition: A student fails if any subject has a score below 33.
- Grade Calculation: Grades are assigned based on the average marks as follows:
- A+ : 80 to 100
- A : 70 to 79
- A- : 60 to 69
- B : 50 to 59
- C : 40 to 49
- D : 33 to 39
- F : Below 33
The program checks for mark validity, calculates total marks, average marks, and assigns grades based on the conditions described above.
- Mark Validation: Marks should be between 0-100.
- Fail Condition: Marks below 33 result in a failing grade.
- Grade Calculation: Based on average marks.
- Modular Design: Functions for each task for reusability and clean code.
.
βββ result.php # Main PHP program with functions and test cases
βββ README.md # Documentation (this file)
To run this project locally:
-
Clone the repository:
git clone https://github.com/prantomollick/accessible-registration-form.git cd accessible-registration-form/student_result
-
Run the PHP file:
- Use a local PHP server or any server like XAMPP, MAMP, or WAMP to run the
result.php
file.
Or run it from the terminal:
php result.php
- Use a local PHP server or any server like XAMPP, MAMP, or WAMP to run the
- Marks Input: You can provide an array of marks for five subjects, where each subject has a mark between 0 and 100.
- Mark Validation: The program checks if all marks are within the valid range.
- Fail Condition: It checks if any subject has a failing mark (below 33).
- Grade Assignment: Based on the average marks, a grade is calculated and displayed along with the total and average.
$studentMarks1 = [
'Math' => 45,
'English' => 55,
'Science' => 60,
'History' => 70,
'Geography' => 50
];
Output:
Total Marks: 280
Average Marks: 56
Grade: B
$studentMarks2 = [
'Math' => 25, // Below 33
'English' => 55,
'Science' => 60,
'History' => 70,
'Geography' => 50
];
Output:
Failing mark found in Math with mark 25.
$studentMarks3 = [
'Math' => 105, // Invalid mark (>100)
'English' => 55,
'Science' => 60,
'History' => 70,
'Geography' => 50
];
Output:
Mark range is invalid for Math.
$studentMarks4 = [
'Math' => 90,
'English' => 95,
'Science' => 85,
'History' => 80,
'Geography' => 92
];
Output:
Total Marks: 442
Average Marks: 88.4
Grade: A+
$studentMarks5 = [
'Math' => 33,
'English' => 35,
'Science' => 38,
'History' => 34,
'Geography' => 36
];
Output:
Total Marks: 176
Average Marks: 35.2
Grade: D
$studentMarks6 = [
'Math' => 100,
'English' => 100,
'Science' => 100,
'History' => 100,
'Geography' => 100
];
Output:
Total Marks: 500
Average Marks: 100
Grade: A+
This project is licensed under the MIT License - see the LICENSE file for details.
π₯ @prantomollick β @prantomollick55 βοΈ [email protected] π https://prantomollick.com
This project is develope by me to complete assignment projectPranto Mollick