admin管理员组

文章数量:1122833

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

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

Share Improve this question asked Mar 1, 2013 at 14:42 howardrockshowardrocks 1034 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

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;

本文标签: phpPath for contact form file