You can remove the else statement so that user will see the message and will be able to upload csv again or you can redirect using
echo '<script>windows.location.href="' . $url . '"</script>';
die;
Edit
$admin_services = add_menu_page( 'Fee Schedule', 'Fee Schedule', 'administrator', 'pd- services', 'pd_services' );
function pd_services() {
?>
<div class="wrap">
<form name="csvupload" action="" method="POST" enctype="multipart/form-data">
<table class="form-table">
<tr>
<th><label for="uploadcsv">Upload Services from CSV</label></th>
<td><input type="file" name="service_upload_csv" id="upload_csv_id" aria-required="true"></td>
</tr>
<td>
<p class="submit">
<input type="submit" class="button-primary" name="admin_service_csv_upload"
value="<?php _e( 'Save Changes' ) ?>"/>
</p>
</td>
</table>
</form>
<?php echo $content ?>
</div>
function process_pd_services_upload() {
if ( $_SERVER["REQUEST_METHOD"] == "POST" && isset( $_POST['admin_service_csv_upload'] ) ) {
if ( get_file_extension( $_FILES["service_upload_csv"]["name"] ) != 'csv' ) {
$error[] = 'Only CSV files accepted!';
}
if ( ! $error ) {
$tot = 0;
$handle = fopen( $_FILES["service_upload_csv"]["tmp_name"], "r" );
//echo $file = $_FILES["service_upload_csv"]["tmp_name"];
while ( ( $data = fgetcsv( $handle, 1000, "," ) ) !== false ) {
for ( $c = 0; $c < 1; $c ++ ) {
//only run if the first column if not equal to firstname
if ( $data[0] != 'Department Name' ) {
$insert_csv_query = "INSERT INTO wp_services(
dept_name,
inc_10_codes,
description,
uc_fee
)VALUES(
'" . mysql_real_escape_string( $data[0] ) . "',
'" . mysql_real_escape_string( $data[1] ) . "',
'" . mysql_real_escape_string( $data[2] ) . "',
'" . mysql_real_escape_string( $data[3] ) . "'
)";
$insert_csv_query;
$inserted = $wpdb->query( $insert_csv_query );
}
echo $tot ++;
}
}
fclose( $handle );
$_SESSION['pd_services_total_import'] = $tot;
wp_safe_redirect( admin_url( 'your admin url here' ) );
}
}
}
add_action( 'wp', 'process_pd_services_upload' );
In the redirected page you can display message from the $_SESSION['pd_services_total_import']
an then unset( $_SESSION['pd_services_total_import'] )