I am trying to create a Wordpress webpage that has an input text box and a button. what I want to do is take the input text from the text box and use it as a parameter to search a table I put into the website database and print the results on the screen. I tried using PHP to no avail. what is the best to do this? here is the code
Search the Film Database <input id="input" name="input" type="text" /> [php] global $wpdb; echo '<button type="button" onclick="myFunction()">Search</button>'; $text = sanitize_text_field($_POST['input']); echo $text; $wpdb->query('USE vcuw2938212664'); function myFunction(){ $txt = sanitize_text_field($_POST['input']); echo 'text is "$txt; $query = 'SELECT * FROM documentaries WHERE English_Title = \'%Li%\';'; echo $query; $results = $wpdb->get_results($query); if ($results != Null){ echo "{$results}"; } else { echo 'no results returned'; } } [/php]
[php]
shortcodes, they're a major security risk