When visitors click on the Submit
button on the form created in the previous recipe, the target of the form is set to be the same page that is hosting the submission form. Since this page is not capable of handling form data, we must implement an action hook that intercepts this post data and sends it to a processing function that we will define. This recipe shows how to implement a function responsible for processing user input.
You should be running the final version of the Book Reviews plugin created in Chapter 4, The Power of Custom Post Types, and should have already followed the Creating a client-side content submission form recipe. Alternatively, you can get the files from the code bundle (Chapter 4/ch4-book-reviews/ch4-book-reviews-v11.php
and Chapter 6/ch6-book-review-user-submission/ch6-book-review-user-submission-v1.php
), and rename ch6-book-review-user-submission-v1.php
to ch6-book-review-user-submission.php
.