<?php include('dbcon.php'); ?> <!DOCTYPE html> <html> <head> <title>MySQL Edit & Delete Live Update</title> <link rel="stylesheet" type="text/css" href="style.css" /> </head> <body> <center><h1 class="header-text">MySQL Edit & Delete Live Update</h1></center> <form method="post" action="add.php"> <div> <label for="fname">First Name</label> <input type="text" id="fname" name="Firstname"> <label for="mname">Middle Name</label> <input type="text" id="mname" name="Maiden"> <label for="lname">Lastname</label> <input type="text" id="lname" name="Lastname"> <label for="email">Email Address</label> <input type="text" id="email" name="Emailadd"> <input type="submit" name="submit" value="ADD"> </div> </form> </body> </html>
<table> <?php ?> <tr> <th>Firstname</th> <th>Middle Name</th> <th>Lastname</th> <th>Email Address</th> <th>Update</th> </tr> <tr> <td><?php echo $user_rows['Firstname'] ; ?></td> <td><?php echo $user_rows['Maiden'] ; ?></td> <td><?php echo $user_rows['Lastname'] ; ?></td> <td><?php echo $user_rows['Emailadd'] ; ?></td> <td><a href="delete.php<?php echo '?id='.$user_rows['UserID']; ?>"><button class="button1">DELETE</button></a> <a href="edit.php<?php echo '?id='.$user_rows['UserID']; ?>"><button class="button2">EDIT</button></a> </td> </tr> <?php }?> </table>
<?php $Firstname=$_POST['Firstname']; $Maiden=$_POST['Maiden']; $Lastname=$_POST['Lastname']; $Emailadd=$_POST['Emailadd']; mysql_query("update users_name set Firstname='$Firstname',Maiden='$Maiden',Lastname='$Lastname',Emailadd='$Emailadd' where UserID='$id'"); } ?>
<?php ?>