'', 'g_aths_status' => '', 'g_aths_order' => '', 'g_aths_date' => '', 'g_aths_id' => '' ); // Form submitted, check the data if (isset($_POST['g_aths_form_submit']) && $_POST['g_aths_form_submit'] == 'yes') { // Just security thingy that wordpress offers us check_admin_referer('g_aths_form_add'); $form['g_aths_text'] = isset($_POST['g_aths_text']) ? wp_filter_post_kses($_POST['g_aths_text']) : ''; if ($form['g_aths_text'] == '') { $g_aths_errors[] = __('Please enter the announcement.', 'announcement-ticker-highlighter-scroller'); $g_aths_error_found = TRUE; } $form['g_aths_status'] = isset($_POST['g_aths_status']) ? sanitize_text_field($_POST['g_aths_status']) : ''; if ($form['g_aths_status'] == '') { $g_aths_errors[] = __('Please select the display status.', 'announcement-ticker-highlighter-scroller'); $g_aths_error_found = TRUE; } if($form['g_aths_status'] != "YES" && $form['g_aths_status'] != "NO") { $form['g_aths_status'] = "YES"; } $form['g_aths_order'] = isset($_POST['g_aths_order']) ? intval($_POST['g_aths_order']) : ''; if ($form['g_aths_order'] == '') { $g_aths_errors[] = __('Please enter the display order, only number.', 'announcement-ticker-highlighter-scroller'); $g_aths_error_found = TRUE; } // No errors found, we can add this Group to the table if ($g_aths_error_found == FALSE) { $sql = $wpdb->prepare( "INSERT INTO `".WP_g_aths_TABLE."` (`g_aths_text`, `g_aths_status`, `g_aths_order`) VALUES(%s, %s, %s)", array($form['g_aths_text'], $form['g_aths_status'], $form['g_aths_order']) ); $wpdb->query($sql); $g_aths_success = __('New details was successfully added.', 'announcement-ticker-highlighter-scroller'); // Reset the form fields $form = array( 'g_aths_text' => '', 'g_aths_status' => '', 'g_aths_order' => '', 'g_aths_date' => '', 'g_aths_id' => '' ); } } if ($g_aths_error_found == TRUE && isset($g_aths_errors[0]) == TRUE) { ?>

0) { ?>