hey i have some error what don't know how to solve it! i want to make a student information website. i have view.php page & edit.php . when i edit a student details i find a lot of error! can anyone help me to solve this asap? my codeing page and error imge given bellow: ! Error:enter image description here
View.php page: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://ift.tt/kkyg93">
<html xmlns="http://ift.tt/lH0Osb">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Viewing The Records</title>
</head>
<body>
<a href="user_registration.php">Insert New Record</a>
<a href="logout.php">Logout</a>
<table align="center" width="1000px" border="2px">
<tr>
<td align="center" bgcolor="#FFFF00" colspan="20"><h1>Viewing All The Records</h1></td>
</tr>
<tr align="center">
<th>Serial No:</th>
<th>Student Name:</th>
<th>Father's Name:</th>
<th>Mother's Name:</th>
<th>Roll No:</th>
<th>Delete</th>
<th>Edit</th>
<th>Details</th>
</tr>
<?php
define("DB_SERVER","localhost");
define("DB_USER","root");
define("DB_PASS","");
define("DB_NAME","students");
$connection= mysqli_connect(DB_SERVER, DB_USER, DB_PASS, DB_NAME);
//Connection Varification................................................................
if(mysqli_connect_errno()){
die("Database connection failed".mysqli_connect_error()."(".mysqli_connect_errno().")");
}
$sql = "SELECT * FROM u_reg ORDER BY 1 DESC";
$result = mysqli_query($connection, $sql);
$i= 1;
while($row= mysqli_fetch_array($result)){
$u_id = $row["u_id"];
$u_student = $row[1];
$u_father = $row[2];
$u_mother = $row[3];
$u_roll = $row[6];
?>
<tr align="center">
<td><?php echo $i; $i++;?></td>
<td><?php echo $u_student;?></td>
<td><?php echo $u_father;?></td>
<td><?php echo $u_mother;?></td>
<td><?php echo $u_roll;?></td>
<td><a href="delete.php?del=<?php echo $u_id;?>" >Delete</a></td>
<td><a href="edit.php?edit=<?php echo $u_id;?>">Edit</a></td>
<td><a href="details.php?details=<?php echo $u_id;?>" >Details</a></td>
</tr>
<?php } ?>
</table><br /><br /><br /><br /><br /><br /><br />
<form action="view.php" method="get">
Search Student: <input type="text" name="search" />
<input type="submit" name="submit" value="Find Now" />
</form>
<br /> <br /> <br /><br />
<?php
$output = "";
if(isset($_GET["search"])){
$search_record = $_GET["search"];
$query= "SELECT * FROM u_reg WHERE u_student= '$search_record' OR u_father= '$search_record'";
$count = mysqli_query($connection, $query);
if($count == false){
$output = "There is no search result !";
}
else{
while($rowon = mysqli_fetch_array($count)){
$student_name2 = $rowon[1];
$father_name2 = $rowon[2];
$mother_name2 = $rowon[3];
$school_name2 = $rowon[4];
$gender2 = $rowon[5];
$roll2 = $rowon[6];
$student_class2 = $rowon[7];
?>
<table width="800px" bgcolor="#FFFF00" align="center" border="1">
<tr align="center">
<td><?php echo $student_name2;?></td>
<td><?php echo $father_name2;?></td>
<td><?php echo $mother_name2;?></td>
<td><?php echo $school_name2;?></td>
<td><?php echo $gender2;?></td>
<td><?php echo $roll2;?></td>
<td><?php echo $student_class2;?></td>
</tr>
</table>
<?php }}}?>
<?php mysqli_close($connection); ?>
</body>
</html>
edit.php page:
<?php
function redirect_to($location){
header("Location: ".$location);
exit;
}?>
<?php
define("DB_SERVER","localhost");
define("DB_USER","root");
define("DB_PASS","");
define("DB_NAME","students");
$connection= mysqli_connect(DB_SERVER, DB_USER, DB_PASS, DB_NAME);
//Connection Varification................................................................
if(mysqli_connect_errno()){
die("Database connection failed".mysqli_connect_error()."(".mysqli_connect_errno().")");
}
$edit_record =$_GET["edit"];
$query= "SELECT * FROM u_reg WHERE u_id = '$edit_record'";
$result = mysqli_query($connection, $query);
while($row = mysqli_fetch_array($result)){
$edit_id = $row["u_id"];
$s_name = $row[1];
$s_father = $row[2];
$s_mother = $row[3];
$s_school = $row[4];
$s_gender = $row[5];
$S_roll = $row[6];
$s_class = $row[7];
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://ift.tt/kkyg93">
<html xmlns="http://ift.tt/lH0Osb">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link type="text/css" rel="stylesheet" href="style.css" />
<title>Updating Student's Record</title>
</head>
<body>
<div id="student_container">
<h2>Record Updating FORM</h2>
<form action="edit.php?edit_form=<?php echo $edit_id;?>" method="post" enctype="multipart/form-data">
<table border="0px" width="1100px" align="center">
<tr align="right">
<td bgcolor="#FFFF00"> Student Registration Form</td>
</tr>
<tr>
<td width="50px" align="right">Student Name:</td>
<td><input type="text" name="student_name1" size="52px" value="<?php echo $s_name; ?>"/></td>
</tr>
<tr>
<td width="50px" align="right">Father's Name:</td>
<td><input type="text" name="fathers_name1" size="52px" value="<?php echo $s_father ;?>"/></td>
</tr>
<tr>
<td width="50px" align="right">Mother's Name:</td>
<td><input type="text" name="mother_name1" size="52px" value="<?php echo $s_mother; ?>"/></td>
</tr>
<tr>
<td width="50px" align="right">School Name:</td>
<td><input type="date" name="school_name1" size="20px" value="<?php echo $s_school;?>"/></td>
</tr>
<tr>
<td width="50px" align="right">Gender:</td>
<td>
<input type="radio" name="gender1" value="<?php echo $s_gender;?>"> Male
<input type="radio" name="gender1" value="<?php echo $s_gender;?>"> Female
</td>
</tr>
<tr>
<td></td>
<td width="50px">Class & Batch Details</td>
</tr>
<tr>
<td width="50px" align="right">Roll:</td>
<td><input type="text" name="roll1" size="12px" value="<?php echo $S_roll;?>"/></td>
</tr>
<tr>
<td width="50px" align="right">Class:</td>
<td>
<select name="student_class1">
<option value="<?php echo $s_class;?>"<?php echo $s_class;?>/>Select Class</option>
<option value="six">SIX</option>
<option value="seven">SEVEN</option>
<option value="eight">EIGHT</option>
<option value="nine">NINE</option>
<option value="ten">TEN</option>
</select>
</td>
</tr>
<tr>
<td width="50px" align="center"></td>
<td><input type="submit" name="update" value="UPDATE" /></td>
</tr>
</table>
</form>
</div><!-----------student_container----->
</body>
</html>
<?php
if(isset($_GET["update"])){
$edit_record1= $_GET["edit_form"];
$student_name1= $_POST["student_name1"];
$fathers_name1= $_POST["fathers_name1"];
$mother_name1= $_POST["mother_name1"];
$school_name1= $_POST["school_name1"];
$gender1= $_POST["gender1"];
$roll1= $_POST["roll1"];
$student_class1= $_POST["student_class1"];
$query1= "UPDATE u_reg SET u_student = '$student_name1', u_father= '$fathers_name1', u_mother = '$mother_name1', u_school = '$school_name1', u_gender = '$gender1', u_roll ='$roll1', u_class ='$student_class1' WHERE u_id = '{$edit_record1}' ";
$result1= mysqli_query($connection, $query1);
if($result1){
echo redirect_to("view.php?updated=Record Has Been Successfully Updated!");
}
}
?>
Aucun commentaire:
Enregistrer un commentaire