I have been trying to get this directory to work properly and am about to tear my hair out!!:icon_mad:
This is my code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<title>Directory</title>
<body>
<?php
error_reporting(E_ALL & ~E_NOTICE);
$lname=$_POST["lastname"];
$fname=$_POST["firstname"];
$addr=$_POST["address"];
$cty=$_POST["city"];
$stat=$_POST["state"];
$zip=$_POST["zipcode"];
$acode=$_POST["areacode"];
$phone=$_POST["telephone"];
$words[] = wordCheck($lname, "lastname");
$words[] = wordCheck($fname, "firstname");
$words[] = wordCheck($addr, "address");
$words[] = wordCheck($cty, "city");
$words[] = wordCheck($stat, "state");
$words[] = wordCheck($zip, "zipcode");
$words[] = wordCheck($acode, "areacode");
$words[] = wordCheck($phone, "telephone");
global $errorCount;
function DisplayError($fieldName, $errorMsg)
{
echo "Error for \"$fieldName\": $errorMsg<br \>\n";
++$errorCount;
}
function wordCheck($data, $fieldName)
{
if (empty($data))
{
DisplayError($fieldName, "Please enter $fieldName");
$retval = "";
}
else
{
return $data;
}
}
if ($errorCount>0)
{
echo "Please re-enter data.<br />\n";
}
else
$filename = "file.txt";
$fp = fopen($filename, "w+");
$output1 =array($lname, $fname, $addr, $cty, $stat, $zip, $acode, $phone);
ksort($output1);
echo "<tr>";
echo "<td>$output1</td>";
?>
</body>
</html>
unfortunately all I get when I run this as output is the word array and nothing else!!:icon_sad:
If anyone can see what I am doing wrong here I would be eternally grateful!!
PLEASE HELP ME!!!!:icon_redface: