I have a form that brings in content from a database and I want the user to be able to select a student and delete it from the database. I get a error saying UNDEFINED INDEX. I am new to php. Thanks in advance for any help here is my code
<section>
<form action="include/borrar2.php" method="post">
<center>
<?php
$sql="select * from registro";
$res=mysql_query($sql);
echo "<table border='1' class='tabla'>";
echo"<thead>";
echo"<tr>";
echo"<th class='op'>"."ID"."</th>";
echo"<th class='op'>"."Detalle"."</th>";
echo"<th class='op'>"."Costo"."</th>";
echo"<th class='op'>"." "."</th>";
echo"<th class='op'>"." "."</th>";
echo"</tr>";
echo"</thead>";
while ( $row = mysql_fetch_array($res)) {
echo "<tr>";
echo "<td name='id'>".$row['id']."</td>";
echo "<td>".$row['detalle']."</td>";
echo "<td>".$row['costo']."</td>";
echo "<td class='opcionT op' >"."<a href=''>"."<input type='submit' value='Actualizar' class='btn2'>"."</a>"."</td>";
echo "<td class='opcionT op' >"."<a href=''>"."<input type='submit' value='Eliminar' name="eliminar" class='btn2'>"."</a>"."</td>";
echo "</tr>";
}
echo "</table>";
?>
</center>
</form>
</section>
php
if (isset($_POST['eliminar'])) {
$idrow = $_POST['id'];
$sql="DELETE FROM `agenda` WHERE `id` = $idrow";
$res=mysql_query($sql);
if($res){
echo '<script>alert("Datos Registrados..")</script>';
echo "<script>location.href='../index.php'</script>";
}else{
echo "Error :(" ;
}
}