Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7024033
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T23:47:15+00:00 2026-05-27T23:47:15+00:00

I am new to wordpress plug in development. I have designed a search form

  • 0

I am new to wordpress plug in development. I have designed a search form however I have no idea where to handle and print the submitted form data.
it is a wedget based plug in and the plugin form section code is here:

   function widget( $args, $instance ) {
    extract( $args );
        $title = apply_filters( 'widget_title', $instance['title'] );
                $message = apply_filters( 'widget_content', $instance['content'] );
        echo $before_widget;
        //if ( $title )
        //  echo $before_title . $title . $after_title;
        echo '<div class="shk_location_form_holder">
                    <span class="shk_loc_title">'.$title.'
                    <form mthod="post">
                    <input type="text" name="shk_inp_search_locations" id="shk_inp_search_locations" /><br>
                    <div style="height:5px"></div>
                    <input type="submit" Value="Search Locations" />
                    </form></div>';
        echo $after_widget;
                if(isset($_REQUEST['shk_inp_search_locations'])){
                    add_filter('the_content','handle_content');
                }
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T23:47:15+00:00Added an answer on May 27, 2026 at 11:47 pm

    In WP plugins you usually have an empty action=”” in a form, and handle it in the same function (by the way, as wordpress procedural code becomes very messy, it’s better to write plugins using OOP), because, anyway plugins are loaded before any content is outputted in WP (this is the reason why writing ajax plugins is so easy in wp). So you can have everything structured like this:

    function draw_form() {
        handle_submit();
    ?>
    <div class="shk_location_form_holder">
        <span class="shk_loc_title"><?php echo $title; ?></span>
        <form mthod="post" action="">
            <input type="text" name="shk_inp_search_locations" id="shk_inp_search_locations" /><br>
            <div style="height:5px"></div>
            <input type="submit" Value="Search Locations" />
        </form>
    </div>
    <?
    }
    
    function handle_submit() {
        if(isset($_POST['shk_inp_search_locations']) && $_POST['shk_inp_search_locations'] == 'test') {
            echo 'you may want to end your program here, especially if it\'s ajax!';
            exit;
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to wordpress development and created a widget that works fine, however I'm
I'm new to WordPress. I have my site (CMS) divided to several pages in
I have created a simple WordPress plugin that automatically sets my new sites up
I have 2 custom fields in my WordPress system when creating new posts. One
Iv'e just started a new Wordpress blog and I have started to build the
I am new to wordpress and i want to transfer data from one page
i am very new to wordpress. I have a div for links and I
On a new WordPress 2.8 installation, I have some posts assigned to category Foo
I'm very new to WordPress and have no PHP or CSS experience... I'm want
I am new to wordpress. I want to post data to some url which

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.