Call another page in forms

WordPress has a generic handler to deal with all forms – admin-post.php. If you include a hidden field in your form called action, you can then hook in to a function of your choice with all the goodness of wordpress included. echo “<form action='”.get_admin_url().”admin-post.php’ method=’post’>”; echo “<input type=”hidden” name=”action” value=”submit-form” />”; echo “<input type=”hidden” name=”hide” … Read more

How to selected value default in option list?

should be selected=”selected” NOT “selected=selected” EDIT: Ok I see – it’s because you are using a foreach arguement to say that it’s selected. Meaning that it prints the HTML showing that everything should be selected. Try something like this: <select name=”pais” class=”pais-select”> <option value=”” disabled selected>País</option> <option value=”Argentina”>Argentina</option> <?php $pais = diretorio_request(‘pais’); foreach(diretorio_countries() as $country) … Read more

Make a page (url) not cacheable [closed]

This has nothing to do with caching, but with form auto-completion. It is happening because the browser is set to store form content. To avoid this, you should generate a random code and add it to the name attribute of your input tags. Then send the random generated number trough another hidden input so you … Read more

How to redirect to a page after the form is submitted

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=”” … Read more

Simple form validation for custom post type in front end. Not working

Your validation is not working because the variables with the empty array return true with isset; Go to http://writecodeonline.com/php/ and try this code, and you’ll understand: $test = “”; if ( isset($test) ){ echo “true”; } The right function for it, instead of isset is empty. Try it out: $test = “”; if ( empty($test) … Read more

Adding data to custom wordpress database table

WordPress doesn’t work this way. If you want to work with a framework like WordPress, you should obey its rules! Of course you can add a database record like this, but it is a really bad approach. Try some plugins for creating and saving forms in WordPress like Ninja Forms or Quform. You can even … Read more

Form Plugin for Api Requests which is used via Shortcode

First, create a function to process the form. In the shortcode function, first process the form and then return any form/message that you want to display to the user. /** * Plugin Name: NewsletterFormConnector * Description: Newsletter Form to connect to Newsletter Api * Author: emjay * Version: 1.0 */ //Add function file require_once(plugin_dir_path(__FILE__) . … Read more