1

I have a custom form in WordPress theme template but it is displaying internal server error upon submission. There is no error in error.log file regarding this submission. I am hosting my website on bluehost and here is my form

<form method="post"  action="<?php echo get_template_directory_uri(); ?>/formprocessing.php">    
        <label for="first-name">Name*</label>
        <input class="form-control" type="text" id="name" name="volunteerName" required/>
        <label for="address">Address*</label>
        <input class="form-control" type="text" id="address" name="volunteerAddress" required/>
        <label for="email">Email*</label>
        <input class="form-control" type="email" id="email" name="volunteerEmail" required/>
        <input class="form-control" class="btn btn-primary" type="submit" value="Submit" id=""/>
</form>

In formprocessing.php file I am just displaying some text and upon submission it redirects to this template file but displaying Internal server error.

<?php   
if (isset($_POST['volunteerName'])){

echo "Form working";
exit;

}
?>

I have spent a lot of time to figure out this issue but still not able to figure out this. Your help will be much appreciated.

  • 1
    Is that the only code in formprocessing.php? – Sally CJ Mar 25 '19 at 1:20
  • Yes as I am just testing this process @SallyCJ – wpdd Mar 25 '19 at 17:22
  • Your code works fine for me, so try contacting the hosting support team - they might be able to help you. Or, instead of sending the data to formprocessing.php, you could just use the init hook to process the data/submission. – Sally CJ Mar 28 '19 at 4:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.