The code used for index.php is below:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="../styles.css">
<title>PHP: $_GET</title>
</head>
<body>
<h1 class="lesson-h1">PHP: $_GET</h1>
<h3>Please Enter Your Email and Password</h3>
<?php
$email = htmlentities($_GET['email']);
$password = htmlentities($_GET['password']);
if(isset($_GET['email'])){
get($email, $password);
}
function get($e, $p){
if(!$e || !$p){
echo "<script>window.alert('Error: Email and Password are Required');</script>";
}
else {
echo "<p>Your Email Address is <strong>$e</strong> and Password is <strong>$p</strong></p>";
echo "<p>GET Request Submitted: => Email: <strong>$e</strong> | Password: <strong>$p</strong></p>";
}
}
?>
<form action="index.php" method="GET">
<label for="email">Email:
<input type="email" name="email" placeholder="Email">
</label>
<label for="password">Password:
<input type="password" name="password" placeholder="Password">
</label>
<input type="submit" value="Submit">
</form>
<hr>
<?php
include('../show_code.php');
show_code('index.php');
?>
</body>
</html>