The following code works well when the correct URL is used like... http://example.com/user.php?id=joe
Where I need help is where do I add an if statement and how should it be written to provide either a default landing page or better, an input field so the visitor can retype the user name and submit it to have the correct page load.
<?php
$pdo = new PDO('mysql:host=localhost;dbname=users', 'root', '');
// retrieve member's data
$ps = $pdo->prepare("SELECT * FROM members WHERE id = ?");
if(isset($_GET["id"])) {
$ps->execute(array($_GET["id"]));
}
$result = $ps->fetch(PDO::FETCH_ASSOC);
extract($result);
echo $First_Name . ' - ' . $Email;
Any help?