I Put the Database Search for my Plugin. But When Searching gives 404 Error !
What do I do to fix 404 Error?
My Code is:
<?php function qrn_search_code(){ global $wpdb,$table_prefix; if($_POST['submit']) { if($_POST['search']) { $search = $wpdb->get_results("SELECT ID, code FROM ".$table_prefix."qrn_dessini WHERE code LIKE '%".$_POST['search']."%' ORDER BY ID DESC;"); print_r($search); } } <form method="POST" id="searchform"> <input type="text" name="name" class="qr_search" placeholder="جستجوی کد محصول ..."> <input type="submit" name="submit" value="Search" class="qr_submit"> </form> } add_shortcode('search_code','qrn_search_code'); ?>
Thanks
I notice you have a beginning php tag at the end of your function, and also no ending:
<?php
}
add_shortcode('mysearch','search_code');
So I would try to change this to start:
}
<?php
add_shortcode('mysearch','search_code');
?>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.