What is Notice: Undefined index: .. ?

Discussion in 'PHP' started by DavCel, Sep 15, 2011.

  1. DavCel

    DavCel New Member

    Joined:
    Nov 23, 2010
    Messages:
    18
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    Part time C# programmer
    Location:
    Paco, Manila
    I have created a simple submitting form in PHP at school and run it into XAMPP. It work and there is no error or "notice". but when I got home and run the SAME code with no editing in my XAMPP that I downloaded (XAMPP 1.7.5 beta7) it displayed "Notice: Undefined index .."

    What could be the PROBLEM? is it the SETTINGS OF XAMPP? or THE CODE ITSELF?
    help please .. wanting to learn PHP badly! Thanks!
     
  2. DavCel

    DavCel New Member

    Joined:
    Nov 23, 2010
    Messages:
    18
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    Part time C# programmer
    Location:
    Paco, Manila
    My screenshot is attached to this post.
     

    Attached Files:

  3. DavCel

    DavCel New Member

    Joined:
    Nov 23, 2010
    Messages:
    18
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    Part time C# programmer
    Location:
    Paco, Manila
    This is the code:


    Code:
    <?php 
    $Fname = $_POST['Fname'];
    $Eadd = $_POST['Eadd'];
    $subject = $_POST['subject'];
    $query = $_POST['query'];
    
    if (!isset($_POST['submit'])) {
    ?>  
    <html>
    <head>
    <title>Info Inq</title>
    </head>
    <body>
    <h3>Contact Us</h3>
    <form method="post" action="<?php echo $PHP_SELF;?>"> 
    <table border="0">
    <tr><td>Your Name:</td><td><input type="text" size="20" maxlength="20" name="Fname"></td></tr>
    <tr><td>Your Email Address:</td><td><input type="text" size="20" maxlength="36" name="Eadd"></td></tr>
    <tr><td>Confirm Email Adress:</td><td><input type="text" size="20" maxlength="36" name="Eadd"></td></tr>
    <tr><td>Subject:</td><td><input type="text" size="12" maxlength="36" name="subject"></td></tr>
    <tr><td>Your Request or Query:
    </td><td><textarea rows="15" cols="31" name="query" wrap="physical">Enter your request or query!</textarea></td></tr>
    <tr><td></td><td><input type="submit" value="submit" name="submit"></td></tr>
    </table>
    </form>
    <? 
    } else { 
    echo "Hello, ".$Fname.".<br />"; 
    echo "Your Email Adress is ".$Eadd.".<br/>"; 
    echo "Your Subject is ".$subject.".<br/>"; 
    echo "Request or Query: <i>".$query."</i><br />";  
    } 
    ?> 
    and the XAMPP that I used:
     

    Attached Files:

    Last edited by a moderator: Sep 15, 2011
  4. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    Check isset for each of your post variable because if you have notices turned on in the home setup.
     
  5. DavCel

    DavCel New Member

    Joined:
    Nov 23, 2010
    Messages:
    18
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    Part time C# programmer
    Location:
    Paco, Manila
    Is there a way to turn off NOTICE?
     
  6. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
  7. DavCel

    DavCel New Member

    Joined:
    Nov 23, 2010
    Messages:
    18
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    Part time C# programmer
    Location:
    Paco, Manila
    Whoa! it worked! Thanks! :) I'll note that .. :happy:
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice