$service = array(
\'show_option_all\' => \'Select your Service\',
\'show_option_none\' => \'\',
\'option_none_value\' => \'-1\',
\'orderby\' => \'name\',
\'order\' => \'ASC\',
\'show_count\' => 0,
\'hide_empty\' => 1,
\'child_of\' => 0,
\'exclude\' => \'\',
\'include\' => \'\',
\'echo\' => 1,
\'selected\' => \'\',
\'hierarchical\' => 0,
\'name\' => \'reliable-cat\',
\'id\' => \'\',
\'class\' => \'postform\',
\'depth\' => 0,
\'tab_index\' => 1,
\'taxonomy\' => \'category\',
\'hide_if_empty\' => false,
\'value_field\' => \'name\',
);
$area = array(
\'show_option_all\' => \'Select your Area\',
\'show_option_none\' => \'\',
\'option_none_value\' => \'-1\',
\'orderby\' => \'name\',
\'order\' => \'ASC\',
\'show_count\' => 0,
\'hide_empty\' => 1,
\'child_of\' => 0,
\'exclude\' => \'\',
\'include\' => \'\',
\'echo\' => 1,
\'selected\' => \'\',
\'hierarchical\' => 0,
\'name\' => \'reliable-tag\',
\'id\' => \'\',
\'class\' => \'postform\',
\'depth\' => 0,
\'tab_index\' => 2,
\'taxonomy\' => \'post_tag\',
\'hide_if_empty\' => false,
\'value_field\' => \'name\',
);
if(isset($_POST[\'reliable-search-submit-button\'])){
global $wpdb;
$table = $wpdb->prefix . "custom_search_tracker";
$data = array(
\'cst_service\' => esc_attr($_POST[\'search-service\']),
\'cst_area\' => esc_attr($_POST[\'search-area\']),
);
$subscribe = $wpdb -> insert($table, $data);
}
插入数据的代码。
<form name="reliable-search-form" id="reliable-search-form" method="POST" action="<?php bloginfo(\'url\');?>/search-results/">
<div id="reliable-service"><input type="text" id="search-service" name="search-service" value="<?php wp_dropdown_categories($service); ?>" /></div><!-- #reliable-service -->
<div id="reliable-area"><input type="text" id="search-area" name="search-area" value="<?php wp_dropdown_categories($area); ?>" /></div><!-- #reliable-area -->
<div id="reliable-search-submit-form"><input type="submit" id="reliable-search-submit-button" name="reliable-search-submit-button" value="Search" /></div><!-- #reliable-submit-form -->
</form>
没有任何内容插入到表中。我已经将此代码用于订阅列表,它可以工作,所以我想知道为什么它在这里不工作。