Form direction to .php on localhost

Question

You may want to make sure you are creating a brand new page template for this.
http://www.wpbeginner.com/wp-themes/how-to-create-a-custom-page-in-wordpress/

Sve the template in your Child Theme folder

In this template, place you form code where you want it to display.
In the tag, change it to this:

<form id="quiz" method="post">

Also, you should add your grade.php code in here as well.
Create a condition to see it the form is being submitted like so:

if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    enter grade.php code here
} else {
    show form
}

Create a new page and assign it the template your just created. It is probably set to default at the moment.

Save the page and click the visit page link.
Tryout the new form and see if it is working.

You should also grasp this concept for submitting data using a form on WordPress:
https://codex.wordpress.org/WordPress_Nonces

0
Gecko Boy 4 years 2016-10-15T21:27:39-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse