RE: [PHP] Help: Undefined variable
| From: | John W. Holmes | Date: | Tue, 17 Dec 2002 04:57:19 +0000 |
| Subject: | RE: [PHP] Help: Undefined variable | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-128509@lists.php.net to get a copy of this message | ||
Don't double post and do a little thinking for yourself. The error is
undefined variable: Array. That means that where you are using
$Array["URL"], it doesn't have a value, it's, "undefined". Where is
$Array coming from, or where do you think it's coming from?
---John W. Holmes...
PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/
> -----Original Message-----
> From: New B [mailto:avong@charter.net]
> Sent: Monday, December 16, 2002 9:44 PM
> To: php-general@lists.php.net
> Subject: [PHP] Help: Undefined variable
>
> Please help! I am a beginner of php, I got an error from my own
webpage:
>
> Notice: Undefined variable: Array in
C:\Inetpub\wwwroot\php\HandleForm.php
> on line 23
> Please enter a valid Web address!
>
> Below is my code:
>
> <?
> function WriteToFile ($URL, $Description) {
> /* Function WriteToFile takes two arguments--URL and
Description--Which
> will be written to an external file. */
> $TheFile = "C:\Inetpub\wwwroot\php\data.txt";
> $Open = fopen ($TheFile, "a");
> if ($Open) {
> fwrite ($Open,"$URL\t$Description\n");
> fclose ($Open);
> $Worked = TRUE;
> } else {
> $Worked = FALSE;
> }
> return $Worked;
> }// End of WriteToFile Function.
> ?>
> <HTML>
> <HEAD>
> <TITLE>Using Files</Title>
> <BODY>
> <?php
> /* This page receives and handles the data generated by "form.html".
*/
> $Pattern = "(http://)?([^[:space:]]+)([[:alnum:]\.,-_?/&=])";
> if (eregi($Pattern, $Array["URL"])) {
> <---------------------------------------------------------That is line
23
> $Replace = "<a
> href=\"http://\\2\\3\"target=\"_new\">\\2\\3</a>";
> $Array["URL"] = eregi_replace($Pattern, $Replace, $Array["URL"]);
> $CallFunction = WriteToFile ($Array["URL"], $Array["Description"]);
> if ($CallFunction) {
> print("Your submision--$Array[URL]--has been received!<BR>\n");
> } else {
> print ("Your submission was not processed due to a system
> error!<BR>\n");
> }
> } else {
> print ("Please enter a valid Web address!\n");
> }
> ?>
> </BODY>
> </HTML>
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php