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

  • SEARCH
  • Home
  • 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 8034127
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T01:54:50+00:00 2026-06-05T01:54:50+00:00

I want to improve my knowledge in module development (which is far away from

  • 0

I want to improve my knowledge in module development (which is far away from basic), so I try to develop a perimeter search module.
What I’ve achieved for now is a block containing a form:

function perimeter_search_block_view($delta = '') {
  // Define an empty array for the block output.
  $block = array();

  switch($delta) {
    case 'perimeter_search_box':
      $block['subject'] = t('Perimeter search box');
      $block['content'] = drupal_get_form('perimeter_search_form');;
      break;
  }

  return $block;
}

/**
* Implementation of the perimeter search form
* @return array with form data
*/
function perimeter_search_form($form, &$form_state) {
  $form = array(
    '#action' => 'perimeter-search-results',
    'keyword' => array(
      '#type' => 'textfield'
    ),
    'location' => array(
      '#type' => 'textfield'
    ),
    'perimeter' => array(
      '#type' => 'select',
      '#title' => t('Perimeter'),
      '#options' => array('15 km', '30 km', '60 km', '120 km')
    ),
    'submit' => array(
      '#type' => 'submit',
      '#value' => t('Start search')
    )
  );

  return $form;
}

I also have a function to output the search results:

/**
* Implementation of hook_menu()
* @return defined menu/page items
*/
function perimeter_search_menu() {
  $items = array();

  // Search results page
  $items['perimeter-search-results'] = array(
    'title' => t('Perimeter search results'),
    'page callback' => 'perimeter_search_results',
    'access arguments' => array('view perimeter search'),
    'type' => MENU_NORMAL_ITEM
  );

  return $items;
}

/**
* Processing job search queries
*/
function perimeter_search_results() {
  $page_content = t('Search results');
  return $page_content;
} 

My (simple?) question is: how to get the post data (keyword, location, perimeter) in my perimeter_search_results() function?

  • 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-06-05T01:54:52+00:00Added an answer on June 5, 2026 at 1:54 am

    Easy, you have to create the _submit function for your form, here an example:

    function perimeter_search_form_submit($form, &$form_state) {
        /*
         * Your data handling goes here on the $form_state['values']['myfieldname']
         * variable.
         */
         drupal_set_message(t('Awesome, you managed to fill the form!'));
    }
    

    And if you need to validate..

    function perimeter_search_form_validate($form, &$form_state) {
        if($form_state['values'['myfieldname'] == '') {
          form_set_error('', t('Hey, it doesn't work like that!'));
        }
    }
    

    Just remember that if you add the attribute ‘#required’ => TRUE to a form field, the field will be automatically validated to always require that field, so you don’t need to use the validator for that field if you just need that it get compiled.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a table of forum posts, and want to improve the basic search
We have a SQL Server 2005 database for which we want to improve performance
I want to improve knowledge of different programming patterns. I want to write a
I currently have some modest HTML/CSS Know-How and want to improve from there. I
Hello i want improve my search page i am using this query to search
I have a basic script that I want to improve so it goes off
I want to improve a small framework, and therefore I want to get rid
I work on the JBJF Project on SourceForge and we want to improve on
This is my first post in stackoverflow. I want to improve its google pagerank
I am working on image processing library in c#. want to improve performance/speed and

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.