I am with a code where the user connects using his username and password and what I would like to do is that once he is logged in, he will see an alert message where it says:
"Welcome + username +"
I have tried to do it in this way but it is not possible:
<?php if (isset($_SESSION['username'])) : ?>
<script> alert ("Welcome" . <?php echo $_SESSION['username']; ?>)</script>
The alert appears but not with the message I want but with 'undefined'
However, if I don’t put an alert but only a message with the corresponding username, it appears correct:
<?php if (isset($_SESSION['username'])) : ?>
<p>Welcome <strong><?php echo $_SESSION['username']; ?></strong></p>
Could you help me?
Thank you