so I wanted to try some backend style code and ive done some messing around with PHP. I've made a simple program (using html and php) that asks the user to create an account, then these usernames and passwords will be stored.
Im adding a feature (at the bottom) that asks if the user wants to display a certain username (un) and password (pw). However, when i enter some random un's and pw's, and type 1 (so program should output un 1 and pw 1) it does not work...
Any help would be grately appreciated!
<html>
<body>
<style>
input {
font-family: 'Trebuchet MS'
}
form {
font-family: 'Trebuchet MS'
}
body {
background-color: lightblue
}
h1 {
font-family: 'Trebuchet MS'
}
</style>
<h1 id = "signup_here">Signup here!</h1>
<form action = "[the website uses my real name, so im not including it]" method = "get">
Your Username: <input type = "text" name = "username">
<br/>
Your Password: <input type = "text" name = "password">
<input type = "submit">
</form>
<br/>
<?PHP
$username = $_GET["username"];
$password = $_GET["password"];
if(!is_null($username) and !is_null($password)){
echo "<h3>Your username is [$username] and your password is [$password]";
}
?>
<form method = "post">
Please confirm: <input type = "checkbox" name = "up_conf" value = "val1">
<input type = "submit">
</form>
<?PHP
if(isset($_POST["up_conf"])) {
echo "<h3>Thanks for signing up!</h3>";
}
?>
<?PHP
if(isset($_POST["up_conf"])) {
$allusernames = array($_GET["username"]);
$allpasswords = array($_GET["password"]);
}
?>
<form action = "https://PhP-Playground.---.repl.co" method = "get">
Get usernames and passwords? 1/2/3/etc.: <input type = "text" name = "gaup">
<?PHP
if(!is_null($_GET["gaup"])) {
echo "Username:" . $allusernames[$_GET["gaup"]];
echo "Password:" . $allpassword[$_GET["gaup"]];
}
?>
</form>
</body>
</html>