All my range inputs are saving to 1 not to value specified
These are the field names in helper function
public function table_fields() {
$result = array(
'Cntry. NL Rank' => 'TINYINT(1) NOT NULL',
'Cntry. NZ Rank' => 'TINYINT(1) NOT NULL',
'Cntry. SA Rank' => 'TINYINT(1) NOT NULL',
);
return $result;
}
this is the table situation
public function prefix_create_table() {
if ( ! class_exists( 'MB_Custom_Table_API' ) ) {
return;
}
MB_Custom_Table_API::create(
'mb_ranks',
$this->table_fields(),
// array( 'email' )
);
}
this is the input situation
public function your_prefix_register_meta_boxes( $meta_boxes ) {
$variable = $this->table_fields();
$fields = array();
foreach ($variable as $key => $value) {
$fields[] = array(
'id' => $key,
'name' => $key,
'type' => 'range',
// 'std' => 1,
'min' => 1,
'max' => 5,
'step' => 1,
);
}
$meta_boxes[] = array(
'title' => 'Ranks',
'storage_type' => 'custom_table', // Important
'table' => 'mb_ranks', // Your custom table name
'post_types' => ['projects'],
'fields' => $fields,
);
return $meta_boxes;
}