Form in WordPress : 404

You’re probably using an input field that contains name=”name”. A lot of generic words are used by WordPress itself (incl. name, so a best practise is to always prefix_ your fields, like name=”prefix_name”.

Varying Search Result Pages

you can add an hidden filed to your search form and include a different template based on that: <form role=”search” method=”get” id=”searchsupport” action=”https://wordpress.stackexchange.com/”> <label class=”screen-reader-text” for=”s”>Search for:</label> <input type=”text” onfocus=”if (this.value == ‘Search’) {this.value=””;}” onblur=”if (this.value == ”) {this.value=”search”;}” id=”s” name=”s” value=”search” class=”search-form round”> <input type=”hidden” id=”searchsubmit”> <!– this is the magic field —> <input … Read more

Show selected value in a drop down menu

WordPress has a great little function built in for handling selections. <option <?php selected(‘value1’, ‘value2′);?> value=”foo”>Bar</option> You can also check out these form handling functions: checked() http://codex.wordpress.org/Function_Reference/checked disabled() http://codex.wordpress.org/Function_Reference/disabled Your HTML syntax is wrong as well. Per W3C, ‘value’ is not an attribute of the select tag. The value of a select is defined in … Read more

How to sanitize user input?

I am not sure if this helpful or not. As s_ha_dum said, you should post how you are processing the submitted data and sending to db. But for starters, you might look at escaping the outputted data in the form: <input style=”width:100%” type=”text” name=”dataHow to sanitize user input?” id=”title” value=”<?php $title = get_option(‘data_test’); echo esc_attr($title[‘title’]); … Read more

Accept AJAX call with serialized form data

When working with AJAX and Forms in WordPress I like to code in the ajax action to the form so serialize works out of the box. Actually I wrote an article on this last year: https://webdevstudios.com/2015/02/12/handling-ajax-in-wordpress/ But, you’re here for answers, not a blog article, so here’s the brief part of it. You have three … Read more

Return to option page after running PHP script

You said your original code is working. I think you should try using wp_redirect but you can’t output any HTML/Headers for that. Untested, but try the following: Note: intentionally missed out the html/body tags… <?php require_once(‘../../../wp-config.php’); require_once(‘../../../wp-load.php’); global $wpdb; $feedurl=$_POST[‘scimp_feed_url’]; $showcategory=$_POST[‘scimp_show_category’]; $table_name = $wpdb->prefix . ‘scimp’; $wpdb->insert( $table_name, array(‘feedurl’ => $feedurl, ‘category’ => $showcategory)); wp_redirect( … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)