Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Jan 2004
    Posts
    53
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Testing on Localhost Machine always getting errors

    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.

    PHP Code:
    <?
    $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);

    ?>

  • #2
    raf
    raf is offline
    Master Coder
    Join Date
    Jul 2002
    Posts
    6,589
    Thanks
    0
    Thanked 0 Times in 0 Posts
    seemslike your fileadress is incorrect.
    change
    $header = "header.html";
    $footer = "footer.html";

    into

    $header = './header.html';
    $footer = './footer.html';
    Posting guidelines I use to see if I will spend time to answer your question : http://www.catb.org/~esr/faqs/smart-questions.html


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •