Ad

404 /php/contactform-process.php - No Such File Or Directory

- 1 answer

I am trying to execute php with a html form but I get the following output to the console.

[Fri Sep 18 13:04:38 2020] [::1]:59753 Accepted

[Fri Sep 18 11:04:38 2020] [404] /php/contactform-process.php - No such file or directory [Fri Sep 18 13:04:38 2020] [::1]:59753 [404]: POST /php/contactform-process.php - No su ch file or direc tory

[Fri Sep 18 13:04:38 20 20] [::1]:59753 Closing

This is my code

<?php 
    if(isset($_POST['submit'])){
        $to = "[email protected]";
        $from = $_POST['email'];
        $subject = $_POST['subject'];;
        $message = $_POST['message'];
        var_dump($to);
        var_dump($from);
        var_dump($subject);

        $headers = "From:" . $from;
        mail($to,$subject,$message,$headers);
    }
?>

<!-- Contact Form -->
<div class="col-lg-6">
    <form id="ContactForm" data-toggle="validator" action="" method="post">
        <div class="form-group">
            <input type="email" name="email" class="form-control-input" id="cemail" placeholder="Email" required>
            <div class="help-block with-errors"></div>
        </div>
        <div class="form-group">
            <input type="text" name="subject" class="form-control-input" id="csubject" placeholder="Subject" required>
            <div class="help-block with-errors"></div>
        </div>
        <div class="form-group textarea">
            <textarea type="text" name="message" class="form-control-textarea" id="cmessage" placeholder="Write your message here"></textarea>
            <div class="help-block with-errors"></div>
        </div>
        <div class="form-group">
            <input type="submit" value="Submit" class="form-control-submit-button"></input>
        </div>
        <div class="form-message">
            <div id="msgCSubmit" class="h3 text-center hidden"></div>
        </div>
    </form>
</div>

I am using vscode with the php server plugin. I am running PHP 7.4

Ad

Answer

Your code is ok! Please check other javascript/jquery plugins or change your browser some times some of the extensions in Google chrome create such kind of errors. Thanks! Have a nice day.

Ad
source: stackoverflow.com
Ad