PHP

How to Create Student Registration System in PHP MySQL

student registration system
Written by Deepak Raj

Hi in this post i will teach you How to Create a Student registration system in PHP MySQL step by step with Print Function. in this system you can add student information, Print Registered Student info, and search by name, and finally if you want to delete registered student you can delete it . The Student Registration System provides for students the option to register , without the advisor’s prior approval, offered by their colleges during the scheduled registration periods. The students can modify their information selection by adding and/or delete profile. However, when the registration period is over, all previously registered students will be viewable in the system.

How To Create Student Registration System

Creating Database

First we are going to create our Database which store our data.

  • Open Phpmyadmin
  • Click Database Tab and name it is as “iksk”.
  • After creating a Database Click the SQL Tab and paste the below code and then click on Go.
-- phpMyAdmin SQL Dump
-- version 4.2.7.1
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: Sep 20, 2015 at 03:04 PM
-- Server version: 5.6.20
-- PHP Version: 5.5.15

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;

--
-- Database: `iksk`
--

-- --------------------------------------------------------

--
-- Table structure for table `admin_login`
--

CREATE TABLE IF NOT EXISTS `admin_login` (
`id` int(20) NOT NULL,
  `user_name` varchar(500) NOT NULL,
  `password` varchar(500) NOT NULL
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;

--
-- Dumping data for table `admin_login`
--

INSERT INTO `admin_login` (`id`, `user_name`, `password`) VALUES
(1, 'admin', 'admin');

-- --------------------------------------------------------

--
-- Table structure for table `data`
--

CREATE TABLE IF NOT EXISTS `data` (
`id` int(11) NOT NULL,
  `p_y_name` varchar(100) NOT NULL,
  `p_gender` varchar(100) NOT NULL,
  `p_dob` varchar(100) NOT NULL,
  `p_f_name` varchar(500) NOT NULL,
  `p_nationality` varchar(100) NOT NULL,
  `p_m_satus` varchar(500) NOT NULL,
  `p_address` varchar(1000) NOT NULL,
  `p_e_mail` varchar(200) NOT NULL,
  `p_a_r_claimed` varchar(100) NOT NULL,
  `p_edu_quali` varchar(100) NOT NULL,
  `p_img` varchar(1000) NOT NULL,
  `p_reg_id` varchar(100) NOT NULL,
  `p_tra_date` varchar(100) NOT NULL,
  `p_fee_paid` varchar(100) NOT NULL,
  `p_agency` varchar(100) NOT NULL,
  `p_m_payment` varchar(100) NOT NULL
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=14 ;

--
-- Dumping data for table `data`
--

INSERT INTO `data` (`id`, `p_y_name`, `p_gender`, `p_dob`, `p_f_name`, `p_nationality`, `p_m_satus`, `p_address`, `p_e_mail`, `p_a_r_claimed`, `p_edu_quali`, `p_img`, `p_reg_id`, `p_tra_date`, `p_fee_paid`, `p_agency`, `p_m_payment`) VALUES
(7, 'Deepak', 'Male', '2015-09-03', 'Rajkumar', 'Indian', 'Unmarried', 'Ballia', 'Deepak.suhawal@gmaiulk.com', '9169371589', '11th', '7.jpg', '1235', '2015-09-10', '1234', '12', '2015-09-23'),
(8, 'Manoj', 'male', '2015-09-08', 'B.N. Upapdhaya', 'Indian', 'Unmarried', 'Ballia', 'Deepak.suhawal@gmaiulk.com', '9169371589', 'Ba', 'deepak (3).jpg', '001245', '2015-09-01', '545', '50', '2015-09-25'),
(9, 'Deepak Kumar ', 'on', '2015-09-14', 'B.N. Upapdhaya', 'Indian', 'Unmarried', 'Ballia', 'Deepak.suhawal@gmaiulk.com', '9169371589', 'Ba', 'Snapshot_20150901_14.JPG', '001245', '2015-09-15', '545', '12', '2015-09-30'),
(10, 'Deepak Kumar ', 'Male', '2015-09-09', 'Rajkumar', 'Indian', 'Unmarried', 'Ballia', 'Deepak.suhawal@gmaiulk.com', '9169371589', '11th', 'Snapshot_20150901_32.JPG', '001245', '2015-09-16', '545', '12', '2015-09-23'),
(11, 'Deepak Kumar', 'Male', '1998-10-18', 'Mr. Rajkumar ', 'Indian', 'Unmarried', 'Suhawal Ballia Utter Pradesh', 'Deepak.suhawal@gmaiulk.com', '9169371589', '11th', 'deepak (3).jpg', '001245', '2015-09-16', '545', '12', '2015-09-18'),
(12, 'PRIYANSHU RAJ', 'Male', '1999-06-16', 'MR. RAJ KUMAR ', 'INDIAN', 'Unmarried', 'BALLIA', 'DEEPAK.BALLIA@GMAIL.COM', '8545005272', '10TH', 'Deepak (2).jpg', '', '', '25452', '123', '2015-09-30'),
(13, 'PRIYANSHU RAJ', 'Male', '1999-07-01', 'Mr. Rajkumar ', 'Indian', 'Unmarried', 'Suhawal Ballia Utter Pradesh', 'deepa.bootcamp@gmail.com', '8545005272', '10TH', 'deepak (3).jpg', '001245', '2015-09-16', '1234', '50', '2015-10-01');

--
-- Indexes for dumped tables
--

--
-- Indexes for table `admin_login`
--
ALTER TABLE `admin_login`
 ADD PRIMARY KEY (`id`);

--
-- Indexes for table `data`
--
ALTER TABLE `data`
 ADD PRIMARY KEY (`id`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `admin_login`
--
ALTER TABLE `admin_login`
MODIFY `id` int(20) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `data`
--
ALTER TABLE `data`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=14;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;

Creating Database Connection

next step is to create a database connection and save it is as “connect.php”. This form is used to connect our form to Database.

<?php
mysql_connect("localhost","root","");
mysql_select_db("iksk");
?>

Creating the Form and Send Data into Database using PHP

Next step is create a form and save it is as “index.php”. and we are validating form using php to send data into database.

<?php

session_start();

if(!isset($_SESSION['user_name'])){
	header("location: login.php");
	}
else {
?>
<?php //echo $dataofpage ; ?>
<html>

<body bgcolor="" >
<form name="iksk" method="post" action="" enctype="multipart/form-data">
  

    <tr>
      
          <td width="74%" valign="top"><table width="739" height="895" border="0" align="center" cellpadding="0" cellspacing="0" bordercolor="#000033" bgcolor="#FFFFFF">
            <tr height="">
              <td height="auto" colspan="6" align="center" bordercolor="#CC0000" bgcolor=""><?php include('header.php');?></td>
            </tr>
            <tr>
              <td align="right" height="44">
			  <div align="center" class="style5 style15"><strong>Name</strong></div></td>
              <td>
			    
		        <div align="left">
		          <input name="y_name" type="text" size="50" placeholder="Enter Name......" />
		          <br>
                </div></td>
            </tr>
			
            <tr>
              <td height="39" align="right">
			  <div align="center" class="style5 style15"><strong>Gender </strong></div></td>
              <td>
			    
		        <div align="left">
		          <label>
		          <select name="gender">
		            <option>Male</option>
		            <option>Female</option>
	              </select>
		          </label>
		        </div></td>
            </tr>
            
            <tr>
              <td height="33" align="right">
			  <div align="center" class="style5 style15"><strong>Date of Birth </strong></div></td>
              <td>
			    
		        <div align="left">
		          <input name="dob" type="date" size="50" placeholder="Enter date of birth ......" />
                </div></td>
            </tr>
            <tr>
              <td height="32" align="right">
			  <div align="center" class="style5 style15"><strong>Father's Name</strong></div></td>
              <td>
			    
		        <div align="left">
		          <input name="f_name" type="text" size="50" placeholder="Enter Father's Name......" />
                </div></td>
            </tr>
            <tr>
              <td height="33" align="right">
			  <div align="center" class="style5 style15"><strong>Nationality</strong></div></td>
              <td>
			    
		        <div align="left">
		          <input name="nationality" type="text" size="50" placeholder="Enter the Nationality......" />
                </div></td>
            </tr>
			<tr>
              <td height="34" align="right">
			  <div align="center" class="style5 style15"><strong>Marital status</strong></div></td>
              <td>
			    
		        <div align="left">
		          <label>
		          <select name="m_satus">
		            <option>Married</option>
		            <option>Unmarried</option>
	              </select>
		          </label>
		        </div></td>
            </tr>
			<tr>
              <td height="35" align="right">
			  <div align="center" class="style5 style15"><strong>Address</strong></div></td>
              <td>
			    
		        <div align="left">
		          <input name="address" type="text" size="50" placeholder="Enter Address......" />
                </div></td>
            </tr>
			<tr>
              <td height="31" align="right">
			  <div align="center" class="style5 style15"><strong>E-mail</strong></div></td>
              <td>
			    
		        <div align="left">
		          <input name="e_mail" type="text" size="50" placeholder="Enter e_mail......" />
                </div></td>
            </tr>
			<tr>
              <td height="35" align="right">
			  <div align="center" class="style5 style15"><strong>Mobile Number </strong></div></td>
              <td>
			    
		        <div align="left">
		          <input name="a_r_claimed" type="text" size="50" placeholder="Enter Mobile Number......" />
                </div></td>
            </tr>
			<tr>
              <td height="32" align="right">
			  <div align="center" class="style5 style15"><strong>Educational Qualification</strong></div></td>
              <td>
			    
		        <div align="left">
		          <input name="edu_quali" type="text" size="50" placeholder="Enter Education qualification....." />
                </div></td>
            </tr>
			<tr>
              <td height="32" align="right">
			  <div align="center" class="style5 style15"><strong>Upload Image</strong></div></td>
              <td>
			    
		        <div align="left">
		          <input name="image" type="file" size="50"/>
                </div></td>
            </tr>
			<tr>
              <td height="30" align="right">
			  <div align="center" class="style5 style15"><strong>Registraation-id</strong></div></td>
              <td>
			    
		        <div align="left">
		          <input name="reg_id" type="text" size="50" placeholder="Enter regstration-id......" />
                </div></td>
            </tr>
			<tr>
              <td height="34" align="right">
			  <div align="center" class="style5 style15"><strong>Registration Date</strong></div></td>
              <td>
			    
		        <div align="left">
		          <input name="tra_date" type="date" size="50" placeholder="Enter Registration Date......" />
                </div></td>
            </tr>
			<tr>
              <td height="30" align="right">
			  <div align="center" class="style5 style15"><strong>Certificate Number </strong></div></td>
              <td>
			    
		        <div align="left">
		          <input name="fee_paid" type="text" size="50" placeholder="Enter Certificate Number......" />
                </div></td>
            </tr>
			<tr>
              <td height="32" align="right">
			  <div align="center" class="style5 style15"><strong>Roll Number </strong></div></td>
              <td>
			    
		        <div align="left">
		          <input name="agency" type="text" size="50" placeholder="Enter Roll Number......" />
                </div></td>
            </tr>
			<tr>
              <td height="34" align="right">
			  <div align="center" class="style5 style15"><strong>Deate of issue </strong></div></td>
              <td>
			    
		        <div align="left">
		          <input name="m_payment" type="date" size="50" placeholder="Enter Date of issue......" />
                </div></td>
            </tr>
			
			<tr>
              <td align="center" colspan="6"><input type="submit" name="submit"  value="Published Now"></td>
            </tr>
          </table></td>
        </tr>
      </table></td>
    </tr>
  </table>
  
</form>



</body>
</html>


<?php
include("connect.php");
if(isset($_POST['submit']))
{
$post_y_name=$_POST['y_name'];
$post_gender=$_POST['gender'];
$post_dob=$_POST['dob'];
$post_f_name=$_POST['f_name'];
$post_nationality=$_POST['nationality'];
$post_m_satus=$_POST['m_satus'];
$post_address=$_POST['address'];
$post_e_mail=$_POST['e_mail'];
$post_a_r_claimed=$_POST['a_r_claimed'];
$post_edu_quali=$_POST['edu_quali'];
$image_name=$_FILES['image']['name'];
$image_type=$_FILES['image']['type'];
$image_size=$_FILES['image']['size'];
$image_tmp=$_FILES['image']['tmp_name'];

$post_reg_id=$_POST['reg_id'];
$post_tra_date=$_POST['tra_date'];
$post_fee_paid=$_POST['fee_paid'];
$post_agency=$_POST['agency'];
$post_m_payment=$_POST['m_payment'];

if($post_y_name=='' or $post_gender=='' or $post_dob=='' or $post_f_name=='' )
{
 echo "<script>alert('Any of the fields is Empty ')</script>";
 
}
else
{
if($image_type=="image/jpeg" or $image_type=="image/png"
 or $image_type="image/gif")
 {
	if($image_size<=500000)
	{
		move_uploaded_file($image_tmp,"images/$image_name");
	}
	else
	{
	echo "<script>alert('Image is larger, only 50kb size is allowed')</script>";
	
	}
 }
 else
 {
 echo "<script>alert('image type is invalid')</script>";
 }

$query= "insert into data
(p_y_name,p_gender,p_dob,p_f_name,p_nationality,p_m_satus,p_address,p_e_mail,p_a_r_claimed,p_edu_quali,p_img,p_reg_id,p_tra_date,p_fee_paid,p_agency,p_m_payment)
values('$post_y_name','$post_gender','$post_dob','$post_f_name','$post_nationality','$post_m_satus','$post_address','$post_e_mail','$post_a_r_claimed','$post_edu_quali','$image_name','$post_reg_id','$post_tra_date','$post_fee_paid','$post_agency','$post_m_payment')";
if(mysql_query($query))
 {
echo  "<script>alert('All Post And Image has been send in database')</script>";
 }
 else
 {
 echo "<script>alert('All Post And Image has Not been send in database')</script>";
 }
}


}
}
?>

Display Data From Database

in this step retrieve inserted data from database in a page copy the below code and save it is as “displaypage.php”.

<?php

session_start();

if(!isset($_SESSION['user_name'])){
	header("location: login.php");
	}
else {
?>
<?php 
include("connect.php");
$sql="SELECT * FROM data";

$query=mysql_query($sql)or die(mysql_error());

?>
<html>
<style type="text/css">
<!--
.style1 {
	color: #333399;
	font-weight: bold;
}
a:link {
	color: #009900;
	text-decoration: none;
}
a:visited {
	text-decoration: none;
	color: #0000FF;
}
a:hover {
	text-decoration: none;
	color: #FF0000;
}
a:active {
	text-decoration: none;
	color: #FFFF00;
}
a {
	font-weight: bold;
}
-->
</style>
<body>
<h2 align='center'><?php echo @$_GET['deleted']; ?></h2>
<form method="" action="displaypage.php">
<table width="1000" border="1" align="center">

  <tr>
    <td><?php include('header.php');?></td>
  </tr>
  <tr>
    <td><table width="100%" border="1" bgcolor="#FFFFFF">
      <tr>
        <td bgcolor="#9966CC"><span class="style1">ID</span></td>
        <td bgcolor="#9966CC"><span class="style1">Name</span></td>
        <td bgcolor="#9966CC"><span class="style1">Gender</span></td>
        <td bgcolor="#9966CC"><span class="style1">Date Of Birth</span></td>
        <td bgcolor="#9966CC"><span class="style1">Father Name</span></td>
        <td bgcolor="#9966CC"><span class="style1">Reg. No</span></td>
        <td bgcolor="#9966CC"><span class="style1">Roll No.</span></td>
        <td bgcolor="#9966CC"><span class="style1">Print</span></td>
        <td bgcolor="#9966CC"><span class="style1">Delete</span></td>
      </tr>
	    <?php while($row=mysql_fetch_array($query)){?>
      <tr bgcolor="#FFCCFF">
        <td><?php echo $row['0']?></td>
        <td><?php echo $row['1']?></td>
        <td><?php echo $row['2']?></td>
        <td><?php echo $row['3']?></td>
        <td><?php echo $row['4']?></td>
        <td><?php echo $row['14']?></td>
        <td><?php echo $row['15']?></td>
        <td><a href="printpage.php?print=<?php echo$row['0'];?>";>Print Now</a></td>
        <td><a href='delete_page.php?del_page=<?php echo $row['0']; ?>'>Delete</a></td>
      </tr>
	  <?php } ?>
    </table></td>
  </tr>
</table>
</form>
</body>
</html>
<?php } ?>

 

Preview

Student Registration System

student registration system

student registration system

You can Download Complete Source Code by Clicking Below Button.

 

 

About the author

Deepak Raj

Hi, This is Deepak Raj from Sourcecodessite.com.I am a Web Developer, Blogger, Online Instructor and SEO consultant who has been working online for last 4 years and he is running several successful websites on the internet.

1 Comment

Leave a Comment