Click here to Skip to main content
14,634,261 members
Rate this:
Please Sign up or sign in to vote.
See more:

<title>Student Registration Form</title>


	<div id="profil" style="margin-left:250px">
		<form action="" method="post"  class="f" enctype="multipart/form-data">
				<table align="">
						<td align="">*Registration NO:</td>
						<input type="text" name="u_id" required="required" placeholder="Enter Student Registration ID"/>
						<td align="">*Admin Name:</td>
						<input type="name" name="u_name" placeholder="Enter student name" required="required"/>
						<td align="">*Father Name:</td>
						<input type="name" name="u_father" placeholder="Enter father name" required="required"/>
						<td align=""> CNIC/Form-B:</td>
						<input type="text" name="u_cnic" placeholder="Enter Student CNIC No"/>

						<td align="">*Contact Number:</td>
						<input type="text" name="u_mobile" placeholder="Enter Student Mobile No" required="required"/>

						<td align=""> Current Address:</td>
						<input type="name" name="u_address" placeholder="Enter Student Address"/>
						<td align=""> Domicile:</td>
						<input type="name" name="u_domicile" placeholder="Student Domicile"/>
						<td align=""> Religion:</td>
						<input type="name" name="u_religion" placeholder=" e.g :- Islam or Other"  />
						<td align=""> Password:</td>
						<input type="password" name="u_pass" placeholder="Enter password" required="required"/>
						<td align=""> Email:</td>
						<input type="email" name="u_email" placeholder="" />
						<td align=""> Date of Birth:</td>
						<input type="date" name="u_birthday"/>
						<td align=""> Gender:</td>
						<select name="u_gender">
							<option>Select Gender</option>
						<td align=""> Department:</td>
						<select name="u_department">
							<option>Select Department</option>
							<option>Computer Science</option>
							<option>Political Science</option>
						<td align=""> Semester:</td>
						<select name="u_semester">
							<option>Select Semester</option>
							<option>1st Semester</option>
							<option>2nd Semester</option>
							<option>3rd Semester</option>
							<option>4th Semester</option>
							<option>5th Semester</option>
							<option>6th Semester</option>
							<option>7th Semester</option>
							<option>8th Semester</option>					
						<td align=""> Upload Image:</td>
						<input type="file" name="u_image"/>
					<tr align="">
						<td colspan="6"><br><br> 
						<input style="margin-left:370px" type="submit" name="submit" value=" REGISTER " />
			<?php InsertUser();?>


$servername = "localhost";
$username = "root";
$password = "";
$students = "bscsproject";

// Create connection
$conn = mysqli_connect($servername, $username, $password, $admin);

	function InsertUser(){
		global $conn;
			$id = mysqli_real_escape_string($conn,$_POST['u_id']);
			$name = mysqli_real_escape_string($conn,$_POST['u_name']);
			$father = mysqli_real_escape_string($conn,$_POST['u_father']);
			$cnic = mysqli_real_escape_string($conn,$_POST['u_cnic']);
			$mobile = mysqli_real_escape_string($conn,$_POST['u_mobile']);
			$address = mysqli_real_escape_string($conn,$_POST['u_address']);
			$domicile = mysqli_real_escape_string($conn,$_POST['u_domicile']);
			$religion = mysqli_real_escape_string($conn,$_POST['u_religion']);
			$pass = mysqli_real_escape_string($conn,$_POST['u_pass']);
			$email = mysqli_real_escape_string($conn,$_POST['u_email']);
			$b_day = mysqli_real_escape_string($conn,$_POST['u_birthday']);
			$gender = mysqli_real_escape_string($conn,$_POST['u_gender']);
			$department = mysqli_real_escape_string($conn,$_POST['u_department']);
			$semester = mysqli_real_escape_string($conn,$_POST['u_semester']);
			$name = mysqli_real_escape_string($conn,$_POST['u_name']);
			$date = date("M-D-Y");
			$status = "unverified";
			$date = date("m-d-Y");
			$get_email = "select * from users where user_email='$email'";
			$run_email = mysqli_query($conn,$get_email);
			echo "<h2>This email is already registered!</h2>";
		else {
				$insert = "insert into admin (id,name,father,cnic,mobile,
				values ('$id','$name','$father','$cnic','$mobile','$address','$domicile','$religion',
				'$pass','$email','$b_day','$gender','$department','$semester','img.jpg',NOW(),NOW(),'$status') ";
				$run = mysqli_query($conn,$insert);
					echo "<script>alert ('Registered Succesful!')</script>";


What I have tried:

hello Sir Im just making for student registration form to enter the data to xamp database but sir the data is entered to the database but they taking some error's on design form which are given below please solve this issue Im waiting your reply thank you, Error ------> Notice: Undefined index: u_id in C:\xampp\htdocs\bscsproject\admin\admin\sidebarbuttonpages\addadminbutton.php on line 225 ,226,227,228,229,230,231,232,233,234,235,236,237,238,239 , They Take same Error please help me solve this problem
Updated 9-Jul-19 8:15am
Patrice T 9-Jul-19 14:38pm
First problem: this code have only 210 lines.
Shahbid Hussain 10-Jul-19 11:08am
thanks for replying dude , its servername 210 line , and I connected the xamp server localhost , if you have any solution please paste your code here

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100