On Mon, Jul 08, 2002 at 08:06:27PM -0700, Varsha Agarwal wrote:
> The browser gives me error that undefined index
> 'usename'. Can anyone tell me what could be wrong as i
> am very new to HTML and PHP.

I'll bet this is happening the first time you view the page.  That's 
happening because you haven't submitted those variables from the form yet.  
Submit the form and they'll be there.

To have your script display correctly under both conditions, do a if/empty 
test on each key before displaying them.

if ( !empty($_POST['username']) ) {
   echo $_POST['username'];

Another approach is to do a test at the top of the script.  When it's 
empty, set the key to a blank string, which will avoid the unset key 

if ( empty($_POST['username']) ) {
   $_POST['username'] = '';



               PHP classes that make web design easier
        SQL Solution  |   Layout Solution   |  Form Solution
    sqlsolution.info  | layoutsolution.info |  formsolution.info
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
 4015 7 Av #4AJ, Brooklyn NY     v: 718-854-0335     f: 718-854-0409

PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to