I'm trying to create a CRUD data grid with php it is very simple but facing a problem with POST method every time I refresh my page it enters my previous data. Im trying to learn php i have basic knowledge of different languages like c# and java. Kindly answer me as soon as possible.
here is my code :
home.php :
<!DOCTYPE html>
<html lang="en">
<head>
  <title>PHP CRUD</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
</head>
<body>
  <?php require_once 'process.php'; ?>
  <?php
    $mysqli = new mysqli('localhost','root','','crud')or die(mysql_error($mysqli));
    $result= $mysqli->query("SELECT * FROM data")or die($mysqli->error);
    ?>
    <div class="row justify-content-center">
      <table class="table">
        <thead>
          <tr>
            <th>Name</th>
            <th>Location</th>
            <th colspan="2">Action</th>
          </tr>
        </thead>
        <?php while ($row = $result->fetch_assoc()): ?>
        <tr>
          <td>
            <?php echo $row['name'] ?>
          </td>
          <td>
            <?php echo $row['location'] ?>
          </td>
          <td></td>
        </tr>
        <?php endwhile; ?>
      </table>
    </div>
    <div class="container">
      <div class="row justify-content-center">
        <form action="process.php" method="GET">
          <div class="form-group">
            <label>Name</label>
            <input type="text" name="name" class="form-control" value="Enter your name">
          </div>
          <div class="form-group">
            <label>Location</label>
            <input type="text" name="location" class="form-control" value="Enter Your Location">
          </div>
          <div class="form-group">
            <button type="submit" name="save" class="btn btn-primary">Save</button>
          </div>
        </form>
      </div>
    </div>
</body>
</html>This the the process.php :
<?php
$mysqli = new mysqli('localhost','root','','crud') or die(mysql_error($mysqli));
if(isset($_GET['save']))
{
    $name=$_GET['name'];
    $location=$_GET['location'];
    $mysqli->query("INSERT INTO data (name,location) VALUES ('$name','$location')") or die($mysqli->error);
}
?>
 
     
    