PHP minor project for Student Result Management System

PHP Students Result Management System - In this project, we are going to manage students result management system.
Submitted by Jyoti Singh, on January 27, 2018

​This article/project is a problem-based question in which we will get details of a student and will generate a result.

In this problem/project, you have to make a form in html to get the following details of students:

  • School Name
  • Student Name
  • Father’s Name
  • DOB
  • Gender
  • Hindi Marks
  • English Marks
  • Maths Marks
  • Physics Marks
  • Chemistry Marks

Result should contain:

  1. A logo of central board of secondary education.
  2. A remark field to give remark to each subject according to following conditions:
    • If marks less than 35 → "*" remark indicates fail
    • If marks greater 79 → "D" remark indicates distinction
    • Else → "-" remark indicates nothing
  3. You need to show final result below the Result according to following condition:
    • If a student fails in one subject Result should be like this → Compartment in Subject name
    • If a student fails in more than one subject Result should be like this → Fail
    • Else Result should be like this → Pass

Let’s start to solve this problem...

To make your form make a file named "StudentDetails.php" and write below code:

<html>
   <form action="Result.php">
      <table>
         <caption>STUDENT MARKSHEET FORM</caption>
         <tr>
            <td>School Name</td>
            <td><input type=text name=sn size=30></td>
         </tr>
         <tr>
            <td>Student Name</td>
            <td><input type=text name=stn size=30></td>
         </tr>
         <tr>
            <td>Father's Name</td>
            <td><input type=text name=fn size=30></td>
         </tr>
         <tr>
            <td>Dob</td>
            <td><input type=text name=dob size=30></td>
         </tr>
         <tr>
            <td>Gender</td>
            <td><input type=radio name=gen size=30 value="Male">Male<input type=radio name=gen size=30 value="Female">Female</td>
         </tr>
         <tr>
            <td>Hindi marks</td>
            <td><input type=text name=hin size=30></td>
         </tr>
         <tr>
            <td>English marks</td>
            <td><input type=text name=eng size=30></td>
         </tr>
         <tr>
            <td>Maths marks</td>
            <td><input type=text name=math size=30></td>
         </tr>
         <tr>
            <td>Physics marks</td>
            <td><input type=text name=phy size=30></td>
         </tr>
         <tr>
            <td>Chemistry marks</td>
            <td><input type=text name=chem size=30></td>
         </tr>
         <tr>
            <td><input type=submit></td>
            <td><input type=reset></td>
         </tr>
      </table>
   </form>
</html>

Run your file and you should see something like this:

PHP - Student Result Management System

Now your form is ready! It’s time show the result to student. To show the result make a file named "Result.php" .Add following code to it:

<html>
<?php
	$sn=$_GET['sn'];
	$stn=$_GET['stn'];
	$fn=$_GET['fn'];
	$dob=$_GET['dob'];
	$gender=$_GET['gen'];
	$hindi=$_GET['hin'];
	$english=$_GET['eng'];
	$maths=$_GET['math'];
	$physics=$_GET['phy'];
	$chemistry=$_GET['chem'];
	$total=$hindi+$english+$maths+$physics+$chemistry;
	$remark1=0;
	$remark2=0;
	$remark3=0;
	$remark4=0;
	$remark5=0;
	$count=0;
	$s="a";
	$gen='';
	$min=35;
	$max=100;
	$hin='Hindi';
	$eng='English';
	$math='Maths';
	$phy='Physics';
	$chem='Chemistry';

	if($gender=="Male"){
		$gen="S/o";
	}else if($gender=="Female"){
		$gen="D/o";
	}
	if($hindi<35){
		$remark1="<font color='red'>*</font>";
		$count++;
		$s=$s.' and '.$hin;
	}else if($hindi>79){
		$remark1="<font color='green'>D</font>";
	}else{
		$remark1='-';
	}
	
	if($english<35){
		$remark2="<font color='red'>*</font>";
		$count++;
		$s=$s.' and '.$eng;
	}else if($english>79){
		$remark2="<font color='green'>D</font>";
	}else{
		$remark2='-';
	}

	if($maths<35){
		$remark3="<font color='red'>*</font>";
		$count++;
		$s=$s.' and '.$math;
	}else if($maths>79){
		$remark3="<font color='green'>D</font>";
	}else{
		$remark3='-';
	}

	if($physics<35){
		$remark4="<font color='red'>*</font>";
		$count++;
		$s=$s.' and '.$phy;
	}else if($physics>79){
		$remark4="<font color='green'>D</font>";
	}else{
		$remark4='-';
	}
	
	if($chemistry<35){
		$remark5="<font color='red'>*</font>";
		$count++;
		$s=$s.' and '.$chem;
	}else if($chemistry>79){
		$remark5="<font color='green'>D</font>";
	}else{
		$remark5='-';
	}

	$s=str_replace('a and', '', $s);
	if($count>2){
		$s="Fail";
	}else if($count==0){
		$s="Pass";
	}else if($count<=2){
		$s="Compartment in ".' '.$s;
	}
?>

<center>
	<table border=1>
		<tr>
		<td>
			<table  width=100%>
			<tr>
				<td>
					<img src='images.jpg' width=120 height=120>
				</td>
				<td>
					<b><font size='5'>CENTRAL BOARD OF HIGHER EDUCATION</font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b><br><br>
					<font size='4' color='grey'><b><?php  echo "$sn"; ?></b></font>
				</td>
			</tr>
			</table>
		</td>
		</tr>
		<tr>
		<td>
			<table width=100%>
				<tr><td><font size='4'><?php echo "$stn"; ?>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo "$gen";?>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo" Mr.$fn";?></font></td></tr>
				<tr><td><font size='4'><?php echo "$dob"?>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo"$gender";?></font></td></tr>
			</table>
		</td>
		</tr>
		<tr>
		<td>
			<table border=1 width=100%>
				<tr><th><i>Subject code</i></th><th><i>Subject name</i></th><th><i>Min marks</i></th><th><i>Max marks</i></th><th><i>Marks obtained</i></th><th><i>Remark</i></th></tr>
				<tr><td>101</td><td>Hindi</td><td>35</td><td>100</td><td><?php echo "$hindi"; ?></td><td><?php echo "$remark1"; ?></td></tr>
				<tr><td>102</td><td>English</td><td>35</td><td>100</td><td><?php echo "$english"; ?></td><td><?php echo "$remark2"; ?></td></tr>
				<tr><td>103</td><td>Maths</td><td>35</td><td>100</td><td><?php echo "$maths"; ?></td><td><?php echo "$remark3"; ?></td></tr>
				<tr><td>104</td><td>Physics</td><td>35</td><td>100</td><td><?php echo "$physics"; ?></td><td><?php echo "$remark4"; ?></td></tr>
				<tr><td>105</td><td>Chemistry</td><td>35</td><td>100</td><td><?php echo "$chemistry"; ?></td><td><?php echo "$remark5"; ?></td></tr>
				<tr><td></td><td></td><td><b>Total</b></td><td><b>400</b></td><td><b><?php echo "$total"; ?><b></td><td></td></tr>
			</table>
		</td>
		</tr>

		<tr>
		<td>
			<table>
				<tr><td><b><font size='4'>Result:&nbsp;&nbsp;&nbsp;&nbsp;<?php echo "$s"; ?></font></b></td></tr>
			</table>
		</td>
		</tr>
	</table>
</center>

</html>

To test this run your StudentDetails file and hit submit button, you should see your result like this:

PHP project output- Student Result Management System



Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.