Notice: Undefined variable:name

Ye' old general discussion board. Basically, for everything that isn't covered elsewhere. Come here to shoot the breeze, shoot your mouth off, or whatever suits your fancy.
This forum is not for asking programming related questions.

Moderator: General Moderators

Post Reply
User avatar
nehrav
Forum Commoner
Posts: 38
Joined: Sun Sep 20, 2009 6:55 am
Location: New Delhi
Contact:

Notice: Undefined variable:name

Post by nehrav »

Hi frndz,

I am trying to develop a login form and after login variables posted to the checkvariables page, where passed variables check the entry in database and if enter details (username and password) match, then it redirect towards user info page otherwise it show wrong username or password.

Now problem is I want to post the value i.e. username on user info page.

Plz help me how I can do this......

I get this error, on using $myusername=$_POST['myusername'];

Notice: Undefined variable: myusername in C:\wamp\www\test\user_info.php on line 28
User avatar
jackpf
DevNet Resident
Posts: 2119
Joined: Sun Feb 15, 2009 7:22 pm
Location: Ipswich, UK

Re: Notice: Undefined variable:name

Post by jackpf »

Can you post the whole code?
User avatar
nehrav
Forum Commoner
Posts: 38
Joined: Sun Sep 20, 2009 6:55 am
Location: New Delhi
Contact:

Re: Notice: Undefined variable:name

Post by nehrav »

jackpf wrote:Can you post the whole code?

What code ?? :crazy:

Its like login.php (username, pass) > checklogin.php (If username & pass match, then redirect to user_info.php, and if dont match then an error "wrong username / password"

Problem is that, I am posting username and password to checklogin.php, whereas I want username on user_info.php also.

So, I want to know Is it possible to post the same form on 2 different pages :?:

I am using Welcome <?php $result['myusername']; ?> OR $myusername=$_POST['myusername'];, to show Welcome Nehrav

but it gives me error "variable is not defined". And I know its not defined
tell me hw I tell the page that username is ...., coz form is posted to checklogin.php, not to user_info.php
User avatar
jackpf
DevNet Resident
Posts: 2119
Joined: Sun Feb 15, 2009 7:22 pm
Location: Ipswich, UK

Re: Notice: Undefined variable:name

Post by jackpf »

The code that's giving you the error. One line is not enough...

And it sounds like you want to look into sessions.
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Re: Notice: Undefined variable:name

Post by John Cartwright »

If you want to persist the data for multiple requests, as jackpf suggests, your best bet is to use sessions.
User avatar
nehrav
Forum Commoner
Posts: 38
Joined: Sun Sep 20, 2009 6:55 am
Location: New Delhi
Contact:

Re: Notice: Undefined variable:name

Post by nehrav »

John Cartwright wrote:If you want to persist the data for multiple requests, as jackpf suggests, your best bet is to use sessions.

Thanks both of you for your replies, John and Jack

I was using sessions only earlier also, but I think they were not properly used...
now I solve this prob by adding some code from some other's example......

Thanks guys........ :wink:
Post Reply