This is my code:
<?php
$printhename = $_POST['username3'];
if(isset($_POST['username3']) && $printhename == "Carlos"){
echo "<h1 class='title123'>Hello $printhename </h1>";
}
else {
echo "<h1 class='title123'>You don't belong here!</h1>";
}
?>
What I want to do is, if "username3" is not set, the message "You don't belong here is shown". Otherwise, if the name is set and it's Carlos, display the other message. I must be doing this the wrong way because it is always printing "Hello $printhename", regardless of the name that has been input.
I'd like for someone to shed some light on this. I'm new to PHP.
If it helps, here's my HTML code:
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
<div class="centerlogin">
<form class="formlogin" name="login" method="POST" action="testing.php">
<input type="text" placeholder="username" NAME="username3">
<input type="submit" name="login_submit" value="login">
</form>
</div>
</div>