What are the potential security risks when using GET and POST methods in PHP for passing variables between pages?

When using GET method in PHP to pass variables between pages, the data is visible in the URL which can lead to security risks such as exposing sensitive information or allowing for easy manipulation of data. To mitigate this risk, it is recommended to use POST method instead, as it sends data in the request body rather than in the URL.

<form method="post" action="process.php">
  <input type="text" name="username">
  <input type="password" name="password">
  <button type="submit">Submit</button>
</form>