Make  simple grade submit form with PHP & Mysql  by following step by step :

PHP is an open source so you can do many customization and can add many functionalities in your websites for helping your clients or users. So always try to make a function or application with a best knowledge of  skill and that can help you and your user mostly. Which is shortly query able and user can used very easily and always try to add as much functionalities. Today I will show how to make a simple grade submit form with PHP. It is very easy to make a grade submit form with php. If you know basic php it not very difficult.

There are many process to do it with PHP. I use if else condition here to make the grading system. Just few steps to complete.

First copy this code then make a file name grade_submit.php. POST method are applied for this form.

$mark = $_POST['mark'];
if( !empty($_POST['mark'])){
if(preg_match("/[A-Z a-z]$/", $_POST['mark'])){ //to make form validation for alpha as it supports only the numeric
echo "alpha value is not valid";
else if($mark>100 || $mark<0)
echo "Invalid";
else if($mark>=80)
echo "A+";
else if($mark>=75)
echo "A";
else if($mark>=70)
echo "A-";
else if($mark>=65)
echo "B+";
else if($mark>=60)
echo "B";
else if($mark>=55)
echo "B-";
else if($mark>=50)
echo "C+";
else if($mark>=45)
echo "C";
else if($mark>=40)
echo "D";
else if($mark <40)
echo "Failed";
echo "mark field is blank";

Then make a form with simple html mark up like this and save this as a php file. action name must be as the php file name. Or you can put the both file as a same file.

<!DOCTYPE html>
<html lang="en">
<meta charset="UTF-8">
<title>Mark Submission Form</title>
<form action="grade_submit.php" method="post">
<input type="text" name="mark" />
<input type="submit" value="Submit">

If you have any question please feel free to ask.

Useful Tags :