Welcome, Guest
  • Author Topic: PHP: $_POST, $_GET problem for a newbie to php  (Read 2073 times)

    ..:: Mazhar Hasan ::..

    • Mods
    • Systems Administrator
    • *****
    • Posts: 828
    • Cheers
      • View Profile
      • SyedMazharHasan.com
    Hi All! I have a problem, i m new to php, when ever i try to recieve some form data as:

    Code: [Select]

    <?php<br>$name $_POST["name"];<br>?>


    then i always recieve an error written below
    Notice: Undefined index: name in d:\ra\updates\check.php on line 3


    how can i  get rid of this hack??? how can i?
    Your wish is my command

    Jorge Solis

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 14616
      • View Profile
    Re:PHP: $_POST, $_GET problem for a newbie to php
    « Reply #1 on: 12/21/04, 12:06 »
    Get ride of warnings and notice. If is your server, edit the php.ini and change the line of error level:

    error_reporting = E_COMPILE_ERROR|E_ERROR|E_CORE_ERROR

    if is a shared server, change at runtime, add this line at very beginning of your script:

    error_reporting(E_ALL ^ E_NOTICE);


    Jorge

    Ronald Wernecke

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 6203
      • View Profile
      • Professional Support
      • Email
    Re:PHP: $_POST, $_GET problem for a newbie to php
    « Reply #2 on: 12/21/04, 17:16 »
    Hi,
    you can ask if the variable was set, before you try to assign it ;)

    if(isset($_POST["name"])) $name=$_POST["name"];
    happy flashing
    8)
    Ronald

    ..:: Mazhar Hasan ::..

    • Mods
    • Systems Administrator
    • *****
    • Posts: 828
    • Cheers
      • View Profile
      • SyedMazharHasan.com
    Re:PHP: $_POST, $_GET problem for a newbie to php
    « Reply #3 on: 12/24/04, 17:00 »
    Thanx A lot guys!  ;)
    Your wish is my command