The suggestions to use JavaScript are fine, but know that's not the only choice.
Here's a workflow that could work for you that's using only PHP and a different page request for each action.
/users.php?id=5
<h1>Viewing <?php $_GET['id'] ?></h1>
...
<a href="/users.php?id=5&action=edit">Edit this user</a>
/users.php?id=5&action=edit
<h1>Editing <?php $_GET['id'] ?></h1>
...
<a href="/users.php?id=5">Cancel edits</a>
<a href="/users.php?id=5&action=save">Save changes</a>
<a href="/users.php?id=5&action=deleteConfirmation">Delete this user</a>
/users.php?id=5&action=deleteConfirmation
<h1>Are you sure you want to delete <?php echo $_GET['id'] ?></h1>
<a href="/users.php?id=5">Cancel</a>
<a href="/users.php?id=5&action=delete">Confirm</a>
/users.php?id=5&action=delete
$sql = "DELETE FROM users ..."
mysqli_query($sql) ...
header('Location: /users.php?action=deleteSuccessful');
users.php could look something like this (pseudocode)
switch ($_GET['action']) {
case 'edit':
<h1>Editing using...</h1>
<form> ...
break;
case 'save':
mysqli_query('UPDATE USERS SET ...');
header('Location: ...');
break;
case 'deleteConfirmation':
<h1>Are you sure you want to delete user 5</h1>
<form> ...;
break;
case 'delete':
mysqli_query('DELETE FROM USERS ...');
header('Location: ...');
break;
default:
<h1>Viewing User 5</h1>
...
break;
}
Battled-Tested CRUDs
You might want to look into RESTful APIs. There's conventions for setting up a resource for a URL and then using different HTTP verbs to interact with the resource.
Here's a basic crash course for a theoretical User resource
http url description
GET /users display all users
POST /users create a new user
GET /users/1 display user with id: 1
GET /users/1/edit display the edit user page
PUT /users/1 replace all the fields for user id: 1
PATCH /users/1 update 1 or more fields for user id: 1
DELETE /users/1 remove user with id: 1