What are the three common methods for passing data between pages in PHP, and what are the potential drawbacks of each?

One common method for passing data between pages in PHP is using URL parameters. This involves appending data to the URL as key-value pairs, which can then be accessed on the receiving page using the $_GET superglobal. However, this method is not secure as the data is visible in the URL. Another method is using sessions to store data across multiple pages. This involves setting data in the $_SESSION superglobal on one page and accessing it on another. While sessions are more secure than URL parameters, they can introduce potential security risks if not handled properly. Lastly, data can be passed between pages using cookies. Cookies are small pieces of data stored on the client's computer and can be accessed by both the sending and receiving pages. However, cookies also have security concerns as they can be manipulated by the user.

// Using URL parameters
// Sending page
$data = "example data";
$url = "page2.php?data=" . urlencode($data);
header("Location: $url");

// Receiving page (page2.php)
$data = $_GET['data'];
echo "Data received: " . $data;
```

```php
// Using sessions
// Sending page
session_start();
$_SESSION['data'] = "example data";
header("Location: page2.php");

// Receiving page (page2.php)
session_start();
$data = $_SESSION['data'];
echo "Data received: " . $data;
```

```php
// Using cookies
// Sending page
setcookie("data", "example data", time() + (86400 * 30), "/");
header("Location: page2.php");

// Receiving page (page2.php)
$data = $_COOKIE['data'];
echo "Data received: " . $data;