Custom form in theme template displaying internal server error upon submission

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.

Topic internal-server-error forms theme-development Wordpress

Category Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.