$user = $_POST['username']
I have created a login redirect variable (within a php statement) which works if written this way:
$redirect = "admin_$user.php"
but does NOT work if I write it this way
$redirect = "$user_admin.php"
Why does username appear correctly in the first example but not in the second?
Many thanks
Jarow
variable won't display contents
Moderator: General Moderators
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
Probably because PHP doesn't know where the variable ends - it doesn't know that you are trying to access $user, it probably thinks you are looking for $user_admin. (turn your error reporting up to E_ALL and you'll get notices about this sort of thing)
You can do:
or
to make it explicit what variable you are looking for.
Mac
You can do:
Code: Select all
$redirect = $user.'_admin.php';Code: Select all
$redirect = "{$user}_admin.php"Mac