Hi,
I'm testing the following form on:
MS Win98 / IE 5.5 / PHP 4.0 / Apache and it works fine.
However...when I publish the
.php file
and the
data.txt file
on the ISP's MS IIS server, I get undeclared variables and indexes when the
form page loads.
The script follows.
Any help would be greatly appreciated.
Thank you.
Tony Ritter
.....................................................................
// form.php
<html>
<head>
<style>
body {background-color:beige;
body
{
scrollbar-base-color: #FCF6DC;
scrollbar-face-color: #E3DBB5;
scrollbar-track-color: #FCF6DC;
scrollbar-arrow-color: #000;
scrollbar-highlight-color: #fff;
scrollbar-3dlight-color: #7B6D29;
scrollbar-shadow-color: #7B6D29;
scrollbar-darkshadow-color: #E3DBB5;
}
border:5px solid black;
}
textarea {border:1pt solid red;
background-color:white;
color:black;
}
textarea p{font-size:12px;
}
table {border:1pt solid black;
width:700px;
font-size:10px;
background-color:#E3DBB5;
color:#7B6D29;
}
input {border:1pt solid solid red;
background-color:white;
color:black;}
.submit {
background-color:#800000;
color:white;}
p {font-family:arial;
font-size:12px;
}
hr { color:#800000;
}
A:link:{text-decoration:none; color:#7B6D29;}
A:visited:{text-decoration:none; color:#7B6D29;}
A:hover:{text-decoration:underline; color:green}
</style>
</head>
<body>
<?
function WriteToFile ($thecomments,$thename,$theemail)
{
$TheFile = "data.txt";
$Open = fopen ($TheFile, "a+");
if ($Open)
{
fwrite ($Open, "$thecomments\t$thename\t$theemail\n");
fclose ($Open);
$Worked = TRUE;
}
else
{
$Worked = FALSE;
}
return $Worked;
}
function ReadTheFile()
{
$TheFile="data.txt";
$Open=fopen($TheFile,"r");
if ($Open)
{
print("<hr>");
print("<P><i>Some of the messages have been:</i>\n");
$Data=file($TheFile);
for($n=0; $n<count($Data); $n++)
{
$getline=explode("\t",$Data[$n]);
print("<table>");
print("<tr>");
print("<td><P>$getline[0]</P></TD>\n");
print("</tr>");
print("<tr>");
print("<TD><P>$getline[1]</P></TD>\n");
print("</tr>");
print("<tr>");
print("<TD><a href=mailto:$getline[2]><P>$getline[2]</P></a>\n");
print("</tr>");
print("</P>");
print("</table>");
} //end for loop
fclose($Open);
} //end if
else
{
print("Unable to read data.txt");
}
} //end function
function createform()
{
print("<form action=\"form.php\" method=post>\n");
print("<P>So...How did <b><u>you</u></b> like EagleFest 2003?:<BR> <textarea
name=\"comments\" rows=3 cols=85></textarea> <br><br>\n");
print("Your name: <input type=text name=\"yourname\" size=30>\n");
print("Your e-mail: <input type=text name=\"youremail\" size=30>\n");
print("<input type=hidden name=\"beensubmitted\" value=\"TRUE\">\n");
print("<input type=submit name=\"submit\" <span class=\"submit\"
value=\"click to submit\">\n");
print("</form>\n");
}
function handleform()
{
global $comments;
global $yourname;
global $youremail;
$comments=stripslashes($comments);
$yourname=stripslashes($yourname);
$youremail=stripslashes($youremail);
$callfunction=WriteToFile($comments,$yourname,$youremail);
if($callfunction)
{
print("<p align=\"center\"> </p>");
print("<p align=\"center\"> </p>");
print("<p align=\"center\"> </p>");
print("<p align=\"center\"> </p>");
print("<p align=\"center\"> </p>");
print("<P align=\"center\"><font size=3 color=\"#800000\"><B>Thank you
for your comments about EagleFest 2003.</text></B></font></P>");
}//end if
else
{
print("Your submission was not processed.");
} //end else
}
if($beensubmitted)
{
handleform();
}
else
{
createform();
ReadTheFile();
}
?>
</body>
</html>
.......................................................
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php