Created
January 18, 2018 21:45
-
-
Save netwons/bca2422b4b49c4f6312b1416afc09360 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if(isset($_GET['idq'])){ | |
$query=" SELECT * FROM m1 WHERE id=" .$_GET['idq']; | |
$result =mysqli_query($connection,$query); | |
$row=mysqli_fetch_assoc($result); | |
} | |
?> | |
<?php | |
if (isset($_POST['edit'])) { | |
$query = " UPDATE m1 SET name = '{$_POST['name']}', lastname = '{$_POST['lastname']}' WHERE id = '{$_GET['idq']}' "; | |
echo $query; | |
$up= mysqli_query($connection, $query); | |
if ($up) { | |
//return header('Location: select.php'); | |
}else{return "error";} | |
return 'error'; | |
} | |
?> | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<title></title> | |
</head> | |
<body> | |
<form method="post" action="edit.php"> | |
<h1>Edit:</h1> | |
<ul> | |
Name: | |
<input type="text" name="name" value="<?php echo $row['name']; ?>"><br><br> | |
Last Name: | |
<input type="text" name="lastname" value="<?php echo $row['lastname']; ?>"><br> | |
<br><br> | |
<input type="submit" name="edit" value="Edit" >   | |
<a href="../includes/select.php">Cancel</a>   | |
<a href="../index.php">Delete</a> | |
</ul> | |
</form> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment