Page 1 of 1

Notice: Undefined Index.....

Posted: Mon Jan 31, 2005 6:07 am
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

Posted: Mon Jan 31, 2005 6:10 am
by JayBird
im guessing it is becuase ...

Code: Select all

$_POST&#1111;'txtName']
... isn't set

Posted: Mon Jan 31, 2005 6:11 am
by hunterhp
have you tried putting a colon( ; ) after the POST value?

Posted: Mon Jan 31, 2005 6:13 am
by bsuhrid
Yea .. i did .. but didn't worked out ..

Posted: Mon Jan 31, 2005 6:16 am
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.

Posted: Mon Jan 31, 2005 6:17 am
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
...

Posted: Mon Jan 31, 2005 6:25 am
by bsuhrid
thanks .. let me try .. :) will be back ..