Custom template with form to query custom table
-
Theme: Meeta by WPZoom
I am tryig to get a new site up and running for a dog breed association.
I have added a custom table to WP containing the details of several thousand dogs.
I want members to be able to search the db on multiple criteria (name, age, sex, health etc).I created an empty page referencing a custom template containing a simple “SELECT * FROM dogs”; using the WPDB class, which worked fine.
I then inserted an HTML form to accept the search criteria:
<form method="POST" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>">
The procedure doesn’t seem to wait for user input with submit but runs straight through and displays all db records.
Any suggestions gratefully accepted
- The topic ‘Custom template with form to query custom table’ is closed to new replies.