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

<html>
<head>
<title>Student Registration Form</title>

</head>
<body>

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

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

						<td align=""> Current Address:</td>
						<td>
						<input type="name" name="u_address" placeholder="Enter Student Address"/>
						</td>
					</tr>
					
					<tr>
						<td align=""> Domicile:</td>
						<td>
						<input type="name" name="u_domicile" placeholder="Student Domicile"/>
						</td>
	
						<td align=""> Religion:</td>
						<td>
						<input type="name" name="u_religion" placeholder=" e.g :- Islam or Other"  />
						</td>
	
						<td align=""> Password:</td>
						<td>
						<input type="password" name="u_pass" placeholder="Enter password" required="required"/>
						</td>
					</tr>
					
					<tr>
						<td align=""> Email:</td>
						<td>
						<input type="email" name="u_email" placeholder="info@gmail.com" />
						</td>
		
						<td align=""> Date of Birth:</td>
						<td>
						<input type="date" name="u_birthday"/>
						</td>
		
						<td align=""> Gender:</td>
						<td>
						<select name="u_gender">
							<option>Select Gender</option>
							<option>Male</option>
							<option>Female</option>
							
						</td>
					</tr>
					
					<tr>
						<td align=""> Department:</td>
						<td>
						<select name="u_department">
							<option>Select Department</option>
							<option>Computer Science</option>
							<option>Political Science</option>
							<option>Geology</option>
							<option>Sociology</option>
							<option>English</option>
							<option>Maths</option>
							<option>BBA</option>
							
						</td>
			
						<td align=""> Semester:</td>
						<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>
		
						<td align=""> Upload Image:</td>
						<td>
						<input type="file" name="u_image"/>
						</td>
					</tr>
					
					<tr align="">
						
						<td colspan="6"><br><br> 
						<input style="margin-left:370px" type="submit" name="submit" value=" REGISTER " />
						</td>
					</tr>
					
				</table>
			</form>	
			<?php InsertUser();?>
	
	
	
	
	</div>
	
</body>
</html>

<?php

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

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

	function InsertUser(){
		
		global $conn;
		
		if(isset($_POST['submit'])){
			
			$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);
			
			
		if($check==1){
			
			echo "<h2>This email is already registered!</h2>";
			
		}
		else {
				
				$insert = "insert into admin (id,name,father,cnic,mobile,
				address,domicile,religion,pass,email,birthday,gender,
				department,semester,image,register_date,last_login,status) 
				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);
				
				if($run){
					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
Posted
Updated 9-Jul-19 8:15am
v3
Comments
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