Creating a WordPress form with a PHP script and default header
I am trying to create a custom form in WordPress.
Step 1 of the form is HTML code that collects data and sends it to a PHP file through the post method, and then writes it to the MySQL database and creates Step 2 of the form using PHP code.
My problem is that I want to include the default WordPress header and footer in Step 2 of the form that WordPress uses in Step 1. Is there a way to do this by including the code of header.php
and footer.php
in my PHP script?
I have tried putting this at the top of the script:
<?php get_header(); ?>
but it gives me an undefined function error.
Leave an answer