![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Feb 2006
Posts: 18
Rep Power: 0
![]() |
Welcome "username"
Hi
I have a question .. Lets say the user logs in with the name = Heba and goes to the menu page How can i welcome the user with his name like Welcome Heba ! I did this [php]Welcome <? echo "$name";?>[/php] But it gives me this error Welcome Notice: Undefined variable: name in |
|
|
|
|
|
#2 |
|
Programmer
|
Well, it would depend what the variable the user's login is saved as. If it's saved in a variable called $name, then you would use $name. If it's $thisistheuserslogin, then you would use $thisistheuserslogin.
If the variable isn't defined for that script you're using, then it won't work. Here's an example: [PHP] <?php $name = "Heba"; echo "Welcome ".$name; ?>[/PHP] |
|
|
|
|
|
#3 |
|
Newbie
Join Date: Feb 2006
Posts: 8
Rep Power: 0
![]() |
Hi,
i guess your login system works with sessions, then let's say you have the fallow session: $_SESSION['username']; Then you just have to do: [PHP] Welcome <? echo $_SESSION['username'];?> [/PHP] Note: you have to allow/start sessions for each php file.
__________________
Винаги се цели в луната, така и да пропуснеш, пак ще си сред звездите! by ludesign
|
|
|
|
|
|
#4 |
|
Newbie
Join Date: Feb 2006
Posts: 18
Rep Power: 0
![]() |
yes it worked with sessions
thank you ![]() |
|
|
|
|
|
#5 | |
|
Newbie
Join Date: Feb 2006
Posts: 8
Rep Power: 0
![]() |
Quote:
![]()
__________________
Винаги се цели в луната, така и да пропуснеш, пак ще си сред звездите! by ludesign
|
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|