How do I insert the following into my custom table?

$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);
}

The code to insert the 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

Nothing gets inserted into the table. I have used this code for a subscription list and it works so I want to know why it isnt working here.

Topic join-tables Wordpress

Category Web


The reason why it wasn't working was because of my form action. I moved the code to insert data to the search results page and it added the the data to the table like I needed.

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.