Undefined Index
Posted by: rupindersingh366@gmail.com (150.107.93.---)
Date: September 19, 2015 04:42PM

Please Help

Undefined index: edit in C:\wamp\www\training\edit.php on line 5

this file which wants to use using $_GET
( <td><a href="edit.php?edit=<?php echo $id; ?>">Edit</a></td> )



<?php
$con = mysqli_connect("localhost","root",""winking smiley;
mysqli_select_db($con ,"school"winking smiley;

if(isset($_POST['submit']))
{

$name = $_POST['name'];
$fname = $_POST['father_name'];
$class = $_POST['class'];
$grade = $_POST['grade'];
$pass = $_POST['pass'];

$query = "insert into student_info (Name,Father_Name,Class,Grade,Pass_Fail) value ('$name','$fname','$class','$grade','$pass')";

if (mysqli_query($con,$query))
{
echo "<h2>Submit Done</h2>";
}
}

?>
<html>
<head>
<title>Student Registration</title>
<link rel="stylesheet" type="text/css" href="student_info.css">
</head>
<body>
<form action="student_info.php" method="post">
<table border="1px" align="center" width="500px">

<tr align="center" bgcolor="green">
<td colspan="5"><h1>Student Registration</h1></td>

</tr>
<tr bgcolor="yellow" class="tr">
<td align="right">Student Name : </td>
<td><input type="text" name="name"></td>
</tr>
<tr bgcolor="pink" class="tr">
<td align="right">Father Name : </td>
<td><input type="text" name="father_name"></td>
</tr>
<tr bgcolor="gray" class="tr">
<td align="right">Class : </td>
<td><input type="text" name="class"></td>
</tr>
<tr bgcolor="#00CCFF" class="tr">
<td align="right">Grade :</td>
<td><input type="text" name="grade"></td>
</tr>
<tr class="tr" bgcolor="#B870FF">
<td align="right">Pass/Fail :</td>
<td><input type="text" name="pass"></ins></td>
</tr>
<tr class="submit" bgcolor="#CC0099">
<td align="center" colspan="5"><input type="submit" name="submit" value="Submit Form"></ins></td>
</tr>

</table>
</form> <br><br>

<table width="900px" align="center" border="3">
<tr>
<th>Serial No. :</th>
<th>Student Name :</th>
<th>Father's Name :</th>
<th>Class :</th>
<th>Grade :</th>
<th>Result : </th>
<th>Delete :</th>
<th>Edit</th>
</tr>

<?php
$con = mysqli_connect("localhost","root",""winking smiley;
mysqli_select_db($con ,"school"winking smiley;

$query2 = "select * from student_info";
$run_query=mysqli_query($con,$query2);

while($rows = mysqli_fetch_array($run_query))
{

$id = $rows['ID'];
$s_name1 = $rows['Name'];
$f_name2 = $rows['Father_Name'];
$class3 = $rows['Class'];
$grade4 = $rows['Grade'];
$pass5 = $rows['Pass_Fail'];

?>
<tr class="tr_data">
<td><?php echo $id ;?></td>
<td><?php echo $s_name1 ;?></td>
<td><?php echo $f_name2 ;?></td>
<td><?php echo $class3 ;?></td>
<td><?php echo $grade4 ;?></td>
<td><?php echo $pass5 ;?></td>
<td><a href="delete.php?del=<?php echo $id; ?>">Delete</a></td>
<td><a href="edit.php?edit=<?php echo $id; ?>">Edit</a></td>
</tr>
<?php
}
?>
</table>



</body>
</html>



Edited 3 time(s). Last edit at 09/19/2015 04:50PM by Otomatic.

Options: ReplyQuote


Sorry, only registered users may post in this forum.