Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Mar 2006
    Posts
    187
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Error: Notice: Undefined index

    Im new to this PHP stuff, i've been trying it since monday and its 50 times easier than i thought it would be :-). I understand why im getting the following errors, but how can i iliminate it?

    Code:
    Notice: Undefined index: UsrEml in C:\Program Files\EasyPHP 2.0b1\www\login.php on line 8
    
    Notice: Undefined index: UsrPwd in C:\Program Files\EasyPHP 2.0b1\www\login.php on line 8

    PHP Code:
    <?php

    if ($_POST["UsrEml"] || $_POST["UsrPwd"])
    {    
           echo 
    "Processing Page"
    }
    else
    {
        
    ?>
        <form action='login.php' method='post'>
        <label for='UsrNme'>Email Address: </label><input id='UsrEml' name='UsrEml' type='text'>
        <label for='Pwd'>Password: </label><input id='UsrPwd' name='UsrPwd' type='password'>
        <input type='submit'>
        </form>
    <?php
    }
        
    ?>

    Thanks in advance!

  • #2
    Senior Coder whizard's Avatar
    Join Date
    Jan 2005
    Location
    Philadelphia, PA, USA
    Posts
    1,662
    Thanks
    14
    Thanked 76 Times in 76 Posts
    try

    if(!empty($_POST['submit']))
    {
    //Processing page
    }
    else
    {
    //Show form
    }


    To do that, you also have to add name="submit" to your submit button .

    HTH
    Dan
    PHP Tip: If you want to use short tags (<? or <?=$var) then make sure short_open_tag is set to "1". It really helps.

    Don't forget to save everyone time and mark your thread as Resolved :)

    "Also note that it is your responsibility to die() if necessary."

    DON'T USE THE MYSQL_ EXTENSION

  • #3
    Regular Coder
    Join Date
    Mar 2006
    Posts
    187
    Thanks
    5
    Thanked 0 Times in 0 Posts
    thanks, its so easy, i dunno why i even dreaded trying php and mysql, its so easy! :-D


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •