Hey guys!
I am trying to figure out how to retain the form information when a page refreshes but it doesn’t seem to work. I have set the form action towards another page though and use the following code:
<!DOCTYPE html>
<html>
<head>
<title> </title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
</body>
</html>
<?php
session_start();
if(isset($_SESSION['u_uid'])) {
header("Location: index.php?signup=mustlogoutfirst");
exit();
} else {
include 'includes/dbh.php';
include_once 'header.php';
}
?>
<section class="main-container">
<div class="main-wrapper">
<h2>Signup</h2>
<form class="signup-form" action="includes/signup2.php" method="POST">
<label>Firstname</label>
<br></br>
<input type="text" name="first" placeholder="First Name" value="<?php if(isset($_SESSION['u_first'])) { echo $_SESSION['u_first'];}?>">
<label>Lastname</label>
<br></br>
<input type="text" name="last" placeholder="Last Name">
<label>E-Mail</label>
<br></br>
<input type="text" name="email" placeholder="Email">
<label>Username</label>
<br></br>
<input type="text" name="uid" placeholder="User ID">
<label>Password</label>
<br></br>
<input type="password" name="pwd" placeholder="Password">
<label>Basic Subscription Plan</label>
<br></br>
<select name="freelesson">
<option value="Primer Level">Primer Level: Free</option>
</select>
<br></br>
<label>Premium Subscription Plan 1</label>
<br></br>
<select name="subscriptionplan">
<option value="">Choose Subscription Plan 1</option>
<option value="None">None</option>
<option value="Level 1">Level 1</option>
<option value="Level 2">Level 2</option>
<option value="Level 3">Level 3</option>
</select>
<br></br>
<button type="submit" name="submit">Sign up</button>
</form>
</div>
</section>
Should I use session or post for the value output?