Jump to content


Photo

Getting 'Notice' messages, but why ??


  • Please log in to reply
1 reply to this topic

#1 RonenMymon

RonenMymon
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 07 May 2006 - 06:54 AM

I have like 4 notice messages:
Notice: Undefined index: CName in c:\Inetpub\wwwroot\Test\phpDatabase.php on line 17
Notice: Undefined index: CEmail in c:\Inetpub\wwwroot\Test\phpDatabase.php on line 18
Notice: Undefined index: CTextArea in c:\Inetpub\wwwroot\Test\phpDatabase.php on line 20
Notice: Undefined index: CFlag in c:\Inetpub\wwwroot\Test\phpDatabase.php on line 21

But I've defined the varibels before:
17: $NewName = $_REQUEST["CName"];
18: $NewEmail = $_REQUEST["CEmail"];
19: $NewDate = date('Y-m-d G:i:s');
20: $NewMessage = $_REQUEST["CTextArea"];
21: $flag = $_REQUEST["CFlag"];

What can be the problem ??
(The code is working...)


Thanks !
Ronen

#2 Barand

Barand
  • Moderators
  • Sen . ( ile || sei )
  • 18,016 posts

Posted 07 May 2006 - 07:59 AM

I'm assuming there is a form sending this data to your page and when you load the page to display the form you get these messages.

If no data has yet been sent to the page from the form then $_REQUEST["CName"] does not yet exist.

Try

if (isset($_REQUEST["CName"])) {


    $NewName = $_REQUEST["CName"];
    $NewEmail = $_REQUEST["CEmail"];
    $NewDate = date('Y-m-d G:i:s');
    $NewMessage = $_REQUEST["CTextArea"];
    $flag = $_REQUEST["CFlag"];

    # process form data here

}


If you are still using mysql_ functions, STOP! Use mysqli_ or PDO. The longer you leave it the more you will have to rewrite.

Donations gratefully received






moon.png

|baaGrid| easy data tables - and more
|baaChart| easy line, column and pie charts




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users