I have an issue with output in PHP I am trying to print out: Welcome back! Admin You are tester number: 3 Then underneath the buttons Logout and Comment. But it first outputs the buttons then the text.
Code:
<?php
session_start();
if (isset($_SESSION['id'])) {
// session variables into local variables.
$id = $_SESSION['id'];
$username = $_SESSION['username'];
$result = "Welcome back! <br>".$username. "<br> You are tester number: ".$id;
echo ' <button class="btn" type="button" onclick=window.parent.location.href="logout.php" target="_parent">Log out</button>
<button class="btn" type="button" onclick=window.parent.location.href="blog/post.php" target="_parent">Comment</button>
';
} else {
$result = "You are not logged in yet";
}
?>
<?php
echo $result;
?>
<title>Welcome - <?php echo $username ;?></title>
echo $result;echoto this:$result .= '