Thursday, May 13, 2021
Home College Assignments Student Registration Project in PHP

Student Registration Project in PHP

In this Student Registration Project we are providing a form in simple html to the student and that form sends the data to “student.php” file where the data is processed and stored into the database.Please note that the database used is “Oracle” and the code of this Student Registration Project is in PHP-5 and coded in PHP Storm.
We got two files in this project:

  1. index.php (provides the form and transfers the data into student.php)
  2. student.php (gets data from the form and Saves it into database).

The start interface is like below:

student-registration-projYou can download “Student Registration Project” Source from here, or can see the detailed files below:

downloadThe complete code files are:

index.php:

<html>

<body>


<div id="container" style="width:600px;height:600px;margin:0 auto;">


<div id="header" style="background-color:blue;" >

<h1 style="margin-bottom:0;" align="center" >My First PHP App</h1>

	</div>




<div id="content" style="background-color:grey;height:600px;width:600px;float:left;">


<div style="width:200px;margin:0 auto;">

<form method="POST" action="student.php" >


<h2>Add New Student</h2>

			<span><label >ID</label></span> 												
			<input type="text" name="s_id" />
			
			<label>Name</label>
			<input type="text" name="s_name" />
			
			<label>Age</label>
			<input type="text" name="s_age" />
			
			<label>Semester</label>
			<select name="semester">
<option value="1">1st</option>
<option value="2">2nd</option>
<option value="3">3rd</option>
<option value="4">4th</option>
<option value="5">5th</option>
<option value="6">6th</option>
<option value="7">7th</option>
<option value="8">8th</option>
			</select>
			
			<select name="Operation">
<option value="1">Create</option>
<option value="2">Search</option>
<option value="3">Delete</option>
<option value="4">View All</option>
			</select>
		<input type = "submit" value="Perform">


	</form>


	
	</div>


	</div>



<div id="footer" style="background-color:orange;clear:both;text-align:center;">
		my first database app
	</div>


</div>


</body>
</html>

Now the Code of Student.php:

<?php

$id = $_POST["s_id"];
$name = $_POST["s_name"];
$age = $_POST["s_age"];
$semester = $_POST["semester"];
$operation= $_POST["Operation"];

if ($operation=='1' )
{
$conn = oci_connect("system","123","localhost/xe");

$sql = oci_parse($conn,"INSERT INTO STUDENT(S_ID,S_NAME,S_AGE,SEMESTER) VALUES($id,'$name',$age,$semester)");
oci_execute($sql);

echo "student is added successfully";

}

else if ($operation=='2')
{
	echo "
 
";

	$conn=oci_connect("system","123","localhost/xe");


	$sql=oci_parse($conn,"Select * from student where s_name = '$name'");
			oci_execute($sql);
			echo "
<table border=1>";
			echo "
<tr>
<th>ID</th>
<th>NAME</th>
<th>AGE</th>
<th>SEMESTER</th>
</tr>

";
			
			while($row=oci_fetch_array($sql))
			{
				echo "
<tr>
<td>$row[0]</td>
<td>$row[1]</td>
<td>$row[2]</td>
<td>$row[3]</td>

";
			}

			echo "</table>

";
}


else if ($operation=='3')
{

$conn = oci_connect("system","123","localhost/xe");


$query = "delete from student";


$sql = oci_parse($conn, $query);

oci_execute($sql);

echo "Student is deleted";
}


else if ($operation=='4')
{
	echo "
 
";

	$conn=oci_connect("system","123","localhost/xe");


	$sql=oci_parse($conn,"Select * from student");
			oci_execute($sql);
			echo "
<table border=1>";
			echo "
<tr>
<th>ID</th>
<th>NAME</th>
<th>AGE</th>
<th>SEMESTER</th>
</tr>

";
			while($row=oci_fetch_array($sql))
			{
				echo "
<tr>
<td>$row[0]</td>
<td>$row[1]</td>
<td>$row[2]</td>
<td>$row[3]</td>

 ";
			}

			echo "</table>

";
}


?>

the above two files build the whole project for Student Registration. You can change the oracle username and password for yourself that matches the requirements.

- Advertisment -

Most Popular

Android Webview Tutorial With Example | How to Use Webview in Android

Android Webview Tutorial With Example Have you seen an Android app displaying Web content using Webview. This Android Webview Tutorial is about integrating Webview using Android Studio....

Student Registration Project in PHP

In this Student Registration Project we are providing a form in simple html to the student and that form sends the data to "student.php"...

Java GUI Calculator Source Code

Here we have a Java GUI Calculator Source Code for you in which a Java GUI calculator has been created using "swing" and "awt". The calculator has...

Numeric Array in PHP

Numeric arrays can store numbers, strings and any object but their index will be represented by numbers. By default array index starts from zero....