6 Replies - 2659 Views - Last Post: 06 October 2012 - 01:16 AM Rate Topic: -----

#1 basic279  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 16-August 12

The system cannot find the path specified

Posted 05 October 2012 - 02:13 PM

Hello,

I am trying to make a contact form for a website. I have an HTML file named contact_us.html and within that file i have a form.

<form method="post" action="../contact_us.php" id="contactform">
        <div>
            <label for="name"><strong>Name:</strong></label>
            <input type="text" size="85" name="contactname" id="contactname" value="" class="required" />
        </div>
        
        <div>
            <label for="email"><strong>Email:</strong></label>
            <input type="text" size="85" name="email" id="email" value="" class="required email" />
        </div>
        
        <div>
            <label for="subject"><strong>Subject:</strong></label>
            <input type="text" size="85" name="subject" id="subject" value="" class="required" />
        </div>
                            
        <div>
            <label for="message"><strong>Message:</strong></label>
            <textarea rows="5" cols="87" name="message" id="message" class="required"></textarea>
        </div>

        <center><input type="submit" value="Send Message" name="submit" style="border:none" alt="Submit" /></center>
    </form>



i have another file named contact_us.php, it has code

<?php
//If the form is submitted
if(isset($_POST['submit'])) {

    //Check to make sure that the name field is not empty
    if(trim($_POST['contactname']) == '') {
        $hasError = true;
    } else {
        $name = trim($_POST['contactname']);
    }

    //Check to make sure that the subject field is not empty
    if(trim($_POST['subject']) == '') {
        $hasError = true;
    } else {
        $subject = trim($_POST['subject']);
    }

    //Check to make sure sure that a valid email address is submitted
    if(trim($_POST['email']) == '')  {
        $hasError = true;
    } else if (!eregi("^[A-Z0-9._%-]+@[A-Z0-9._%-]+\.[A-Z]{2,4}$", trim($_POST['email']))) {
        $hasError = true;
    } else {
        $email = trim($_POST['email']);
    }

    //Check to make sure comments were entered
    if(trim($_POST['message']) == '') {
        $hasError = true;
    } else {
        if(function_exists('stripslashes')) {
            $comments = stripslashes(trim($_POST['message']));
        } else {
            $comments = trim($_POST['message']);
        }
    }

    //If there is no error, send the email
    if(!isset($hasError)) {
        
        $emailTo = 'abc@abc.com'; //Put your own email address here
      
        $body = "Name: $name \n\nEmail: $email \n\nSubject: $subject \n\nComments:\n $comments";
        $headers = 'From: My Site <'.$emailTo.'>' . "\r\n" . 'Reply-To: ' . $email;

        mail($emailTo, $subject, $body, $headers);
        $emailSent = true;
    }
}
?>

<?php if(isset($hasError)) { //If errors are found ?>
    <p class="error">Please check if you've filled all the fields with valid information. Thank you.</p>
<?php } ?>

<?php if(isset($emailSent) && $emailSent == true) { //If email is sent ?>
    <p><strong>Email Successfully Sent!</strong></p>
    <p>Thank you <strong><?php echo $name;?></strong> for using my contact form! Your email was successfully sent and I will be in touch with you soon.</p>
<?php } ?>

Read more: http://webprocafe.com/php-asp-java/3918-system-cannot-find-path-specified.html#ixzz28SfIQO50




When i submit my form i get error

Quote

The system cannot find the path specified


Can anybody tell me where is the problem please.

Is This A Good Question/Topic? 0
  • +

Replies To: The system cannot find the path specified

#2 CTphpnwb  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 2927
  • View blog
  • Posts: 10,114
  • Joined: 08-August 08

Re: The system cannot find the path specified

Posted 05 October 2012 - 02:19 PM

According to action="../contact_us.php" your script is one directory "higher" than the one that produced the form. Is that correct?
Was This Post Helpful? 0
  • +
  • -

#3 basic279  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 16-August 12

Re: The system cannot find the path specified

Posted 05 October 2012 - 02:34 PM

View PostCTphpnwb, on 05 October 2012 - 02:19 PM, said:

According to action="../contact_us.php" your script is one directory "higher" than the one that produced the form. Is that correct?



i have changed it and still getting the same error.
Was This Post Helpful? 0
  • +
  • -

#4 Sho Ke  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 110
  • View blog
  • Posts: 250
  • Joined: 13-October 11

Re: The system cannot find the path specified

Posted 05 October 2012 - 02:45 PM

What did you change it to? An easy way to get around something like this is to put both files in the same directory if at all possible, but this could get a little disorganized depending on your site's structure.

If you have both files in the same directory(folder), then just use action="contact_us.php"
Was This Post Helpful? 0
  • +
  • -

#5 basic279  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 16-August 12

Re: The system cannot find the path specified

Posted 05 October 2012 - 10:26 PM

I have changed the path to action="contact_us.php". Both files (contact_us.html and contact_us.php) are at the same level of folders or in same folder. but still i am getting the error.
Was This Post Helpful? 0
  • +
  • -

#6 CTphpnwb  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 2927
  • View blog
  • Posts: 10,114
  • Joined: 08-August 08

Re: The system cannot find the path specified

Posted 05 October 2012 - 10:37 PM

Have you emptied your browser's cache or tried another browser?
Was This Post Helpful? 0
  • +
  • -

#7 basic279  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 16-August 12

Re: The system cannot find the path specified

Posted 06 October 2012 - 01:16 AM

yes..just emptied the cache and reloaded the page. but i am still getting the error. There is one more thing..when i give the URL to the file in the address bar. while on loading the page it should not show anything..but in that case i am also getting same error..i am using same email code on another site and there it is working fine. Do you think that it could be the problem with the server services?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1