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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 |
-- 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 @[email protected]@CHARACTER_SET_CLIENT */; /*!40101 SET @[email protected]@CHARACTER_SET_RESULTS */; /*!40101 SET @[email protected]@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', '[email protected]', '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', '[email protected]', '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', '[email protected]', '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', '[email protected]', '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', '[email protected]', '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', '[email protected]', '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', '[email protected]', '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 [email protected]_CHARACTER_SET_CLIENT */; /*!40101 SET [email protected]_CHARACTER_SET_RESULTS */; /*!40101 SET [email protected]_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.
1 2 3 4 |
<?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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 |
<?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”.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
<?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
You can Download Complete Source Code by Clicking Below Button.
I am commenting here for the first time as I
discovered your blog post really outstanding. Maintain the great and thanks a lot
for sharing such essential as well as helpful suggestions!