Warning: eregi() [function.eregi]: REG_ECTYPE in /HandleForm.php on line 24
Please enter a valid Web address!
What's wrong with this code? :
<?
function WriteToFile($URL, $Description) {
/* Function WriteToFile takes two arguments--URL and Description--which will be written to an external file. */
$TheFile = "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>
</head>
<body>
<?php
/* This page receives and handles the data generated by "form.html". */
$Pattern = "([url]http://[/url])?([^[:space]]+)([[:alnum:]\.,-_?/&=])";
if (eregi($Pattern, $Array["URL"])){
$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 submission--$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