error_reporting = E_ALL & ~E_NOTICE
or use
if (isset($Array) && eregi($Pattern, $Array["URL"])) {
New B wrote:
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>
Thanks,
New B
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php