teach me, please!

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • ÃÖ¼±È£

    #1

    teach me, please!

    I'm a begginer
    using IIS(win2000serv er)+PHP+MySQL, I make very simple codes, one html and
    three php files

    communiace.html
    connect.php
    read.php
    write.php

    and I pass the variables within codes by form with "method=pos t" .

    when I connect my server, http://localhost/communicate.html and give any
    values to variables.
    Error messages apear!
    "Notice: Undefined variable: name in E:\2003DATA\web txt\exercise\¾² ±â.php on
    line 14"

    why this message apears !

    please tell me the cause!


  • Thomas Mlynarczyk

    #2
    Re: teach me, please!

    > "Notice: Undefined variable: name in[color=blue]
    > E:\2003DATA\web txt\exercise\¾² ±â.php on line 14"[/color]

    This means that in your code you were using a variable called name (on line
    14 of your code) which does not exist, e.g.:

    if ($name) // first time that $name appears!
    {
    // do something with $name
    }
    else
    {
    // Initialize the variable $name with some value
    $name = "Some value";
    }

    Here, the if-line should trigger the "Undefined variable" notice. This does
    not necessarily mean that there is something wrong. It is just a "reminder".
    You can deliberately use an undefined variable, for instance when you test
    if it exists or not. But it is always a good idea to assign a value to each
    variable explicitly before using it in your code. For example, you could put
    the line

    $name=NULL;

    before the above if-line. The reason is that some evil hacker could easily
    send a variable $name with a value of his own choice to your script. See the
    PHP doc for details (security section).

    Greetings, Thomas



    Comment

    Working...