Path for contact form file

I have a php contact form that I use with all websites, so ideally I want to avoid using a plug in. The files used include:

• contact.php - A file with php/html write up which displays the form fields.

• contact-form.php - A file that contact.php connects to to send the information.

I've created the equivalent of contact.php as a static page in the Wordpress login.

The code within contact.php which connect to contact-form.php is as follows:

form method="post" action="/contact-form.php" 

What I would like to know is how I would connect to this file in the instance of Wordpress - locating files in Wordpress is something which has always confused me...

Thanks

Topic paths php Wordpress

Category Web


You could put both the form and processing logic in the same file and submit the form to the same page by omitting the action attribute. Check $_POST vars to see if the form has been submitted and do your processing, otherwise display the form.

if( isset( $_POST['somevar'] ) ) :
    // process submission
else :
    // show form
endif;

About

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