Depending on the variable found, I'd like that the user connect to a dedicated page.
Here is the part of my code :
session_start();
$_SESSION['username'] = $username;
header("location: welcome.php");
Instead of "welcome.php", I'd like to have "location: welcome_$username.php"
How can I achieve that ? I've tried with echo but it seems I don't understand enough php to find my mistakes.
<?php
$user='test';
header("location: welcome_"."$user".'.php');
And the redirection leads to
http://localhost/welcome_test.php
welcome_$username.php
Will give you a 404 Error after redirecting, lets say the username of that user is John
Your file will be welcome_john.php
which I'm positive it does not exist on your file system rather user a query string.
Then have
header("location: welcome.php?username=".$_SESSION['username']);
Then on welcome use the query string to show different users what ever they need to see on welcome