Skip to content

Instantly share code, notes, and snippets.

@netwons
Created January 18, 2018 21:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save netwons/bca2422b4b49c4f6312b1416afc09360 to your computer and use it in GitHub Desktop.
Save netwons/bca2422b4b49c4f6312b1416afc09360 to your computer and use it in GitHub Desktop.
<?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" >&nbsp&nbsp
<a href="../includes/select.php">Cancel</a>&nbsp&nbsp
<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