• Sorry if I am posting this in the wrong forum.
    I have a feedback type form and a PHP file to send an email, but when I click the submit button on the form, I get an error that the php file can’t be opened. I tried opening it directly from my uploads folder and get the same error. I named the file suggestion-send.php. Created it with Notepad. I thought maybe that was the issue, so I copied a current PHP file, renamed it and pasted my text into it. Still won’t open. I am logged in with an administrator account. This is for a company intranet – not a blog.

    If you need the code it is:
    FORM:
    <form method=”post” name=”myemailform” action=”https://starthere.boselaw.com/wp-content/uploads/bme-items/suggestion-send.php”&gt;
    Enter Name: <input type=”text” name=”name”>
    Enter Email Address: <input type=”text” name=”email”>
    Enter Message: <textarea name=”message”></textarea>
    <input type=”submit” value=”Send Form”>
    </form>

    PHP:
    <?php
    $name = $_POST[‘name’];
    $visitor_email = $_POST[’email’];
    $message = $_POST[‘message’];
    ?>
    <?php
    $email_from = ‘[email protected]’;
    $email_subject = “New Form submission”;
    $email_body = “You have received a new message from the user $name.\n”.
    “Here is the message:\n $message”.
    ?>
    <?php
    $to = “[email protected]”;
    $headers = “From: $email_from \r\n”;
    $headers .= “Reply-To: $visitor_email \r\n”;
    mail($to,$email_subject,$email_body,$headers);
    ?>

Viewing 2 replies - 1 through 2 (of 2 total)
  • I’m pretty sure your domain doesn’t start with starthere.

    Additionally, you’re trying to run a PHP script from within the wp-content/uploads directory tree. For that to be possible, your webserver (Nginx) has to be able to execute php files in that location, and that’s a big security risk. It’s probably disallowed in the server configuration since it returns 403 forbidden.

    Any reason you’re not using one of the multitude of ready-made WordPress contact form plugins?

    Thread Starter ssergutaboselaw

    (@ssergutaboselaw)

    Thanks for the response. I’ve looked at plugins, but haven’t found one I like. I’ll keep looking. I just need a simple form that our users can use to make anonymous suggestions.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘HTML form can't launch PHP file’ is closed to new replies.