| | |
<? echo $myusername ; ?>
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Mar 2009
Posts: 3
Reputation:
Solved Threads: 0
hii there..
im have created a user login page with php and mysql.
but somehow im having problem when i try to show username information after user login.
i have put this code
<? echo $myusername ; ?>
but it doesnt show the username..
what can be the problem?
thnks in advance..
im have created a user login page with php and mysql.
but somehow im having problem when i try to show username information after user login.
i have put this code
<? echo $myusername ; ?>
but it doesnt show the username..
what can be the problem?
thnks in advance..
Last edited by london77; Mar 18th, 2009 at 5:55 pm.
a variable (such as
The Only after you have done that can you retrieve the value of the variable like you did with your
Hope that clarified things.
$myusername ) must be set in the same script for it to have a value, and thus be echo'd to the page. This means the value will be lost if the user refreshes the or follows a link. The
$_SESSION is a special array that will hold it's value for a user until they close their browser. This means when they log in you must set the session variable: php Syntax (Toggle Plain Text)
$_SESSION['myusername'] = "humbug"
echo $_SESSION['myusername']; statement.Hope that clarified things.
★ "If your not having fun, your doing something wrong." - Humbug
★ Did I help you out? Did I piss you off? Add to my reputation!
★ The Gabriel Method is a great book for losing weight and keeping healthy - I know Jon Gabriel Personally.
★ Did I help you out? Did I piss you off? Add to my reputation!
★ The Gabriel Method is a great book for losing weight and keeping healthy - I know Jon Gabriel Personally.
hi this is nathen,
i think this is usefull to you some how,
you first start the session on top first page and the page which you want to show your username.In first page its self you should use $_Post['myusername']=$_SESSION['myusername'];
and you use $_SESSION['myusername'] in your second page where you want to show that value..
i think this is usefull to you some how,
you first start the session on top first page and the page which you want to show your username.In first page its self you should use $_Post['myusername']=$_SESSION['myusername'];
and you use $_SESSION['myusername'] in your second page where you want to show that value..
•
•
•
•
hi this is nathen,
i think this is usefull to you some how,
you first start the session on top first page and the page which you want to show your username.In first page its self you should use $_Post['myusername']=$_SESSION['myusername'];
and you use $_SESSION['myusername'] in your second page where you want to show that value..
$_SESSION['myusername'] = $_POST['myusername'] . you switched them around. there also would need to be some sanitation to prevent xss attacks. ![]() |
Similar Threads
- updating records using php and mysql (PHP)
- Echo MySQL Row Data (PHP)
- Session Login (PHP)
- php and mysql insert...where making me tear my hairs out!!! help!!! (PHP)
- PHP Form, SQL connectivity issues, please help. (MySQL)
- mysql php problems (PHP)
Other Threads in the PHP Forum
- Previous Thread: login redirection
- Next Thread: (urgent) help to display error message
Views: 414 | Replies: 7
| Thread Tools | Search this Thread |
Tag cloud for PHP
.htaccess access ajax apache api array beginner binary broken cakephp checkbox class cms code cron curl database date directory display download dynamic ebooks echo email error file files folder form forms function functions google href htaccess html image include insert integration ip java javascript joomla jquery js limit link login loop mail mediawiki menu methods mlm mod_rewrite multiple mysql oop parse paypal pdf php problem query radio random recursion regex remote script search select server sessions sms soap source space speed sql stored structure subdomain syntax system table tutorial update updates upload url validation validator variable video web xml youtube







