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 2 of 2
  1. #1
    New Coder
    Join Date
    Feb 2008
    Posts
    39
    Thanks
    0
    Thanked 1 Time in 1 Post

    TimeMemoryFunctionLocation error

    Hello I am getting the following error message:

    Notice: Undefined index: id in C:\wamp\www\Test_FAQ.php on line 8 Call Stack #TimeMemoryFunctionLocation 10.0054374168{main}( )..\Test_FAQ.php:0 ">

    I have the following code:

    Code:
    <html>
    <head>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>
    
    <body>
    <form name="listbox" onClick="<?php $_POST['id'];?>">
      <?PHP
      include ("includes/connect.inc");
    	  //start of the array
    enhanced_list_box(array(
      'table'        => 'Services',
      'id_number'    => 'id',
      'value_field'  => 'Service',
      'highlight_id' => 1));
    
    //this display's the listbox so the user can select a service
     function enhanced_list_box($options){
    
      $sql  = "select " . $options['id_number'];
      $sql .= ", " . $options['value_field'];
      $sql .= " from " . $options['table'];
     
      /* append any where criteria to the sql */
      if(isset($options['where_statement'])) {
        $sql .= " where " . $options['where_statement'] ;
      }//CLOSE OF IF STATEMENT
    
      $result = mysql_query($sql)
                or die(mysql_error());
    
    echo '<select name="', $options['id_number'], '" size="1">';
    
    while ($row = mysql_fetch_array($result, MYSQL_NUM))
    {
      if($row[0] == $options['highlight_id']) {
        echo '<option value="', $row[0], '" SELECTED>',
             $row[1], '</option>';
      }//CLOSE OF IF STATEMENT 
      else {
        echo '<option value="', $row[0], '">',
             $row[1], '</option>';
      }//CLOSE OF ELSE STATEMENT
    }//CLOSE OF WHILE STATEMENT
    
    echo '</select>';
    }
    	  
    	  
    ?>
    </form>
    <?php $id = (isset($_GET["id"])) ? $_GET["id"] : "1";?>
    
    
    </body>
    </html>
    But I am getting some error I have never seen before. I am running a wamp test server if that matters?

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    This is a custom stack error. The issue is quite easy, but not with what you have here.
    If I had to guess, this is a custom error handler either prepended into the run or included in something we can't see. I would suspect it is caused by this: <?php $_POST['id'];?>, for which $_POST['id'] may or may not be defined. Treat it as you have with the $_GET at the bottom and use an isset ternary check.
    That said, it also doesn't do anything in specific. Since its not printed, its simply tossing an error but will never actually output anything.


  •  

    Posting Permissions

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