Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 4 of 4
  1. #1
    Senior Member
    Join Date
    Apr 2016
    Posts
    717
    Member #
    53891
    Liked
    11 times

    folder directory not finding file

    so heres my folder structure

    css folder
    fonts folder
    images
    includes (which stored the failed connect class)
    javascript folder
    view

    view contains the footer hand header files

    then there is as follows

    index.php
    contact.php
    contactform.php

    each of the three files use the included header and footer from the view folder so the php is

    include 'view/header.php'

    some php content

    in the case of the contactform.php it includes the form in a html main section in its own file and is included from view folder. that works fine the form is loaded with the header and footer on page

    include 'view/footer.php'

    heres where i get stuck
    in the case where i submit the contact form to contactform.php i get errors for the header and footer not loading.

    heres the code for the html form that resides in the view folder. this is loaded into the contact.php file which means that i do not need to go up a folder using ../ becasue the page is interpreted at the root directory. it should find contactform.php easily.

    PHP Code:
    <div id="contact">
      <
    form method="post" action="contactform.php" >
        <
    input type="text" name="name" placeholder="Name" required>
        <
    input type"email" name="email" placeholder="Email" required>
        <
    input type="number" name="number" placeholder="Phone number" required>
        <
    input type="text" name="subject" placeholder="subject" required>
        <
    textarea name="info" placeholder="further info" required>
            
    further info
        
    </textarea>
          <
    input type="submit" value="submit">
      </
    form>
    </
    div
    heres the contactform.php page. again this is in the root directory above the view folder

    PHP Code:
    <?php
    include 'view/header.php';

    // this function strips out potentially dangerous info to prevent abuse of emailing
    function spam_scrubber($value){
    //create  array with potentially damaging words
      
    $bad_values = ['to:''cc:','bcc:','content-type','mime-version','multipart-mixed','content-transfer-encoding'];
    //loop through array and check for the keywords
      
    foreach($bad_values as $bad){
        if(
    stripos($value$bad) !== false) return '';
      }
    // its important to note that this will return only once upon reaching the first keyword, it will then jump out of the loop
      
    return Trim($value);

    }
    //use array_map to call the scrubber function on each element in post array
    $scrubbed array_map('spam_scrubber'$_POST);
    //use array_map to remove html js and php tags from the newly created $scrubbed array so there should be no need to sanitize data
    $stripped array_map('strip_tags'$scrubbed);

    echo 
    "{$stripped['name']}";

    if (isset(
    $stripped['name']) && isset($stripped['email']) && isset($stripped['number']) && isset($stripped['email']) && isset($stripped['subject']) && isset($stripped['info'])){
      
    $body "name: {$stripped['name']}\n\n Email:{$stripped['email']}\n\n number:{$stripped['bumber']}\n\n subject:{$stripped['subject']}\n\n info:{$stripped['info']}";
      
    $body wordwrap($body70);
      
    mail('info@prattsofcarlow.ie','contact form submission'$body);}


    include 
    'view/footer.php'
     
    ?>
    and here are the errors i get when i submit the form from contact.php

    Warning: include(../view/header.php): failed to open stream: No such file or directory in C:\wamp64\www\final\contactform.php on line 2

    Warning: include(): Failed opening '../view/header.php' for inclusion (include_path='.;C:\php\pear') in C:\wamp64\www\final\contactform.php on line 2

    Warning: include(../view/footer.php): failed to open stream: No such file or directory in C:\wamp64\www\final\contactform.php on line 29

    Warning: include(): Failed opening '../view/footer.php' for inclusion (include_path='.;C:\php\pear') in C:\wamp64\www\final\contactform.php on line 29

    can anyone help?

  2.  

  3. #2
    Senior Member
    Join Date
    Apr 2016
    Posts
    717
    Member #
    53891
    Liked
    11 times
    i did notice the missing ; on the contactform.php page it didnt remedy anything

  4. #3
    Senior Member
    Join Date
    Apr 2016
    Posts
    717
    Member #
    53891
    Liked
    11 times
    when i change the contact form action target to ../contactform.php it says that the file cannot be found on the server

  5. #4
    Senior Member
    Join Date
    Apr 2016
    Posts
    717
    Member #
    53891
    Liked
    11 times
    got this sorted although i dont know how lol


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 02:46 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com