Thread: PHP simple question : undefined index

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User FloatingPoint's Avatar
    Join Date
    Jun 2003
    Posts
    191

    PHP simple question : undefined index

    Firstly, sorry that I didnt know where else to post this question.

    Need help w/ PHP 4.2.0

    I'm following this tutorial here, creating form and processing the info on that form.

    form.html
    Code:
    <html>
    <head>
    <title>Add Elements to a form</title>
    </head>
    
    <body>
    <h1>Welcome to this Site</h1>
    
    <form action="processForm.php" method="POST">
     Your name: <input type="text" name="name">
     Your age:   <input type="text" name="age">
     <input type="submit" value="Enter">
    </form>
    
    </body>
    </html>

    processForm.php

    Code:
    <html>
    <head>
    <title>Process Form Data</title>
    </head>
    
    <body>
    <h3>Your info has been processed</h3>
    
    Hi 
    <?php 
    echo $_POST["name"]; 
    ?>.
    
    You are 
    <?php 
    echo $_POST["age"]; 
    ?> years old.
    
    <br>
    <a target="_new" href="name.php?name=<?php echo $_POST["name"]?>">Show name</a>
    
    </body>
    </html>
    name.php
    Code:
    <html>
    <head>
    <title>name.php</title>
    </head>
    <body>
    
    <p>Applicant:
    <?php 
    echo $_POST["name"];
    ?>
    
    </body>
    </html>
    After entering both the name and age in the form (form.html) and hitting the Submit Query button, PHP processes the info and generates a file to display the name and age. There's also a link on that page to a new page which opens in a new window (name.php).

    The link (show name) works, but the new page (name.php) displays this error:
    Applicant:
    Notice: Undefined index: name in F:\myphp\name.php on line 9


    It's supposed to display the name entered in the form.

    What gives?

    Thanx.
    Last edited by FloatingPoint; 07-15-2003 at 10:11 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Strange/false errors
    By Ganoosh in forum Windows Programming
    Replies: 8
    Last Post: 10-20-2005, 04:54 PM
  2. Simple class question
    By 99atlantic in forum C++ Programming
    Replies: 6
    Last Post: 04-20-2005, 11:41 PM
  3. Simple question about pausing program
    By Noid in forum C Programming
    Replies: 14
    Last Post: 04-02-2005, 09:46 AM
  4. c++ linking problem for x11
    By kron in forum Linux Programming
    Replies: 1
    Last Post: 11-19-2004, 10:18 AM
  5. Binary Search Trees Part III
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 10-02-2004, 03:00 PM