Please fill in all mandatory fields.

'; } function anyguide_invalid_snippet_notice() { echo '

The title can only have alphabets,numbers or hyphen.

'; } function anyguide_existing_snippet_notice() { echo '

This Snippet already exists.

'; } add_action('admin_notices', 'anyguide_mandatory_fields_notice'); add_action('admin_notices', 'anyguide_invalid_snippet_notice'); add_action('admin_notices', 'anyguide_existing_snippet_notice'); $anyguide_snippetId = abs(intval($_GET['snippetId'])); if(isset($_POST) && isset($_POST['updateSubmit'])){ $_POST = stripslashes_deep($_POST); $_POST = anyguide_trim_deep($_POST); $anyguide_snippetId = intval($_GET['snippetId']); $temp_anyguide_title = str_replace(' ', '', sanitize_text_field($_POST['snippetTitle'])); $temp_anyguide_title = str_replace('-', '', $temp_anyguide_title); $anyguide_title = str_replace(' ', '-', sanitize_text_field($_POST['snippetTitle'])); $anyguide_type = sanitize_text_field($_POST['snippetType']); $anyguide_slug = sanitize_text_field($_POST['snippetSlug']); $anyguide_token = sanitize_text_field($_POST['snippetToken']); if ($anyguide_title != "" && $anyguide_type != "" && $anyguide_slug != "" && $anyguide_token != "") { if(ctype_alnum($temp_anyguide_title)) { $snippet_count = $wpdb->query($wpdb->prepare( 'SELECT * FROM '.$wpdb->prefix.'anyguide_short_code WHERE id!=%d AND title=%s LIMIT 0,1',$anyguide_snippetId,$anyguide_title)) ; if($snippet_count == 0){ $anyguide_shortCode = '[anyguide snippet="'.$anyguide_title.'"]'; $wpdb->update( $wpdb->prefix.'anyguide_short_code', array( 'title' => $anyguide_title, 'type' => $anyguide_type, 'slug' => $anyguide_slug, 'token' => $anyguide_token, 'short_code' => $anyguide_shortCode ), array('id'=>$anyguide_snippetId) ); header("Location:".admin_url('admin.php?page=anyguide-manage&any_msg=5')); } else { anyguide_existing_snippet_notice(); } } else { anyguide_invalid_snippet_notice(); } } else { anyguide_mandatory_fields_notice(); } } global $wpdb; $snippetDetails = $wpdb->get_results($wpdb->prepare( 'SELECT * FROM '.$wpdb->prefix.'anyguide_short_code WHERE id=%d LIMIT 0,1',$anyguide_snippetId )) ; $snippetDetails = $snippetDetails[0]; ?>

Edit your Snippet

checked="checked" type == "tours") { ?> checked="checked" value="tours" /> checked="checked" type == "contact") { ?> checked="checked" value="contact" />