Notice: Undefined Index.....

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
bsuhrid
Forum Newbie
Posts: 3
Joined: Mon Jan 31, 2005 6:02 am

Notice: Undefined Index.....

Post by bsuhrid »

Hi

i m using PHP 4.3.4 and getting the error "Notice: Undefined index: txtName in c:\\inetpub\\wwwroot\\trial\\register.php on line 166" in the following line of code:

<form name="form1" method="post" action="confirmation.php?name=<?php echo $_POST['txtName'] ?>">

can someone help please

thank you
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Post by JayBird »

im guessing it is becuase ...

Code: Select all

$_POST&#1111;'txtName']
... isn't set
hunterhp
Forum Commoner
Posts: 46
Joined: Sat Jan 22, 2005 5:20 pm
Contact:

Post by hunterhp »

have you tried putting a colon( ; ) after the POST value?
bsuhrid
Forum Newbie
Posts: 3
Joined: Mon Jan 31, 2005 6:02 am

Post by bsuhrid »

Yea .. i did .. but didn't worked out ..
hunterhp
Forum Commoner
Posts: 46
Joined: Sat Jan 22, 2005 5:20 pm
Contact:

Post by hunterhp »

I don't uderstand why you would make a form value = $_POST. Don't you have to first Submit the value in order for $_POST to work? Can't you make it a $_GET value.
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

before accessing a value in an array (through it's index/key) you first have to check if that index exists...

http://www.php.net/isset
http://www.php.net/array_key_exists
...
bsuhrid
Forum Newbie
Posts: 3
Joined: Mon Jan 31, 2005 6:02 am

Post by bsuhrid »

thanks .. let me try .. :) will be back ..
Post Reply