...

View Full Version : Testing on Localhost Machine always getting errors



wizard210
05-12-2004, 03:48 AM
My local machine has foxserv 3.0 on it, it's a windowsme machine. I'm trying to see if my code will send my form results to a csv file. I believe everything is right with my code but I'm getting this warning:

Warning: Failed opening '' for inclusion (include_path='.;c:\php4\pear') in C:\FoxServ\www\SCHEDULE\postresults2.php on line 18

below is my php code could someone please help me out and let me know what is wrong cause i sure as heck don't.


<?
$header = "header.html";
$footer = "footer.html";
$returnpage = "/";
$youremail = "jmerwin@redbankvalley.net";
$csvfilename = "posts.csv";
$csvquote = "\"\"";
$mode = "FILE";

function doFormError($errString) {

include($header);

echo "<FONT SIZE=+2>The form you submitted was not complete.<BR><BR></FONT>";
echo "$errString<BR><BR>\n";
echo "<INPUT TYPE=BUTTON ONCLICK='history.back()' VALUE=' Return to the resource usage page '><HR>";

include($footer); /this is line 18

exit;
}


function doError($errString) {

include($header);

echo "$errString<BR><BR>\n";

include($footer);

exit;
}


if (($date == "") || ($building == "") || ($grade == "") || ($teacher == "") || ($resource == "") || ($res_use == "") || ($elasped_time == "") || ($b_email == "")) {
doFormError("I'm sorry, but it appears that you forgot to fill in a required field. Please go <A HREF='Javascript:history.go(-1);'>back</A> and correct the error.");
exit;
}

//# checks for valid email address
if( !(ereg("^(.+)@(.+)\\.(.+)$",$b_email)) ) {
doFormError("You submitted an invalid email address. Please go <A HREF='Javascript:history.go(-1);'>back</A> and correct the error.");
exit;
}

$today = date ("l, F jS Y");
$strMessageBody = "";
$strMessageBody .= "A new post has been received. A summary of this post appears below.\n";
$strMessageBody .= "\n";
$strMessageBody .= "Post Date: $today \n";
$strMessageBody .= " \n";
$strMessageBody .= "-------- \n";
$strMessageBody .= " $date\n";
$strMessageBody .= " $building \n";
$strMessageBody .= " $grade \n";
$strMessageBody .= " $teacher \n";
$strMessageBody .= " $resource \n";
$strMessageBody .= " $res_use \n";
$strMessageBody .= " $elasped_time \n";
$strMessageBody .= " \n";


if( $mode == "BOTH" || $mode == "EMAIL") {
//# Send email order to you...
$mailheaders = "From: $b_email\r\n";
$mailheaders .="X-Mailer: PHP Mail generated by:NOP Design Shopping Cart\r\n";
$subject = "New Online Order";
mail($youremail, $subject, $strMessageBody, $mailheaders);
}


if( $mode == "BOTH" || $mode == "FILE") {

$csvcomments = $comment;
if (!$CSVF = fopen($csvfilename,'a')) {
doError("Unable to open CSV file for writing. Your order has not been saved.");
exit;
}

fputs($CSVF, $string);
fputs($CSVF, "\"");
fputs($CSVF, "$today");
fputs($CSVF, "\",\"");
fputs($CSVF, "$date");
fputs($CSVF, "\",\"");
fputs($CSVF, "$building");
fputs($CSVF, "\",\"");
fputs($CSVF, "$grade");
fputs($CSVF, "\",\"");
fputs($CSVF, "$teacher");
fputs($CSVF, "\",\"");
fputs($CSVF, "$resource");
fputs($CSVF, "\",\"");
fputs($CSVF, "$res_use");
fputs($CSVF, "\",\"");
fputs($CSVF, "$elasped_time");
fputs($CSVF, "\",\"");


fclose($CSVF);
}

//# Send email conformation to the customer.....
$mailheaders = "From: $youremail\r\n";
$mailheaders .="X-Mailer: PHP Mail generated by:NOP Design Shopping Cart\r\n";
$subject = "Order Confirmation";
mail($b_email, $subject, $strMessageBody, $mailheaders);

include($header);

echo "<h2>Thank you</h2>";
echo "Thank you for your post. You will receive a confirmation email of your post ";
echo "momentarily. Please contact us at $youremail if you have any questions or concerns.";
echo "<P>";
echo "<A HREF=\"$returnpage\" target=_top>Return Home</A>";
echo "<P>";

include($footer);

?>

raf
05-12-2004, 07:55 AM
seemslike your fileadress is incorrect.
change
$header = "header.html";
$footer = "footer.html";

into

$header = './header.html';
$footer = './footer.html';



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum