I'm making a simple website for school where we have to include php to fill in forms. I'm not able to prefill and then save the content passed in the field. I've been following a pluralsight guide on how to prefill these fields, but it just aint working with me...
if (isset($_POST['submit'])){
$ok = true;
if (!isset($_POST['email']) || $_POST['email'] === ''){
$ok = false;
}
else{
$email = $_POST['email'];
}
if (!isset($_POST['password']) || $_POST['password'] === ''){
$ok =false;
}
else{
$password = $_POST['password'];
}
if ($ok){
printf('Email: %s
<br>Password: %s',
htmlspecialchars(email),
htmlspecialchars(password));
}
}?> <figure class="col-lg-6">
<form method="post" action="login.php">
<div class="row login">
<div class="col-md-6">
<h3>Login</h3>
<div class="form-group">
<label for="exampleInputEmail">Email</label>
<input type="email" class="form-control" placeholder="Enter email*" name="email" value="<?php echo htmlspecialchars($email);?>">
</div>
</div>
</div>
<div class="row login">
<div class="col-md-6">
<div class="form-group">
<label for="InputPassword">Password</label>
<input type="password" class="form-control" placeholder="Enter password*" name="password" value="<?php echo htmlspecialchars($password);?>">
</div>
</div>
</div>
<button type="submit" class="btn tf-btn btn-default" name="login" >Login</button>
</form>
</figure>