I am just not understanding something and apparently, I don't know what it is. I have a wp_list_table that I use to manage a table. I have it working correctly but I would like to edit the values entered. If an error is found, I would like to show an error message at the top of the page that originated the action followed by the original page. Here is the code that I have in my form handler to do this function.
// New or edit?
if ( ! $id ) {
// new
// make sure add name is valid
$table_name = $wpdb->prefix . 'golf_pool_team_roster';
$add_player_name = $fields['add_player_name'];
$drop_player_name = $fields['drop_player_name'];
$sql = 'SELECT * FROM ' . $table_name . ' WHERE player_name = "' . $drop_player_name . ' "';
$result = $wpdb->get_row($sql);
if($result == NULL) {
$message = $drop_player_name . ' not on anyone's roster.';
$redirect_to = add_query_arg( array( 'message' =>
$message));
wp_safe_redirect( $redirect_to );
exit;
}
This takes me back to the starting page, but not error message. When I wp_die($redirect_to, this is returned. '/wordpress/wp-admin/admin.php?page=drop_add&action=new%27s_roster_&message=Tommy Smith not on anyone's roster.'
I would sure appreciate some help.