Support » Fixing WordPress » HTML form can't launch PHP file

  • 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 method=”post” name=”myemailform” action=””>
    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”>

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

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?

    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.