Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Set to the current path so we can redirect back there after submit.
- $form['submission_path'] = array(
- '#type' => 'hidden',
- '#default_value' => current_path(),
- '#weight' => -100,
- );
- $form['#action'] = url('search-callback');
- function mymodule_search_callback() {
- return '';
- }
- // Redirect back to the page that submitted the search.
- $form_state['redirect'] = array(
- $form_state['values']['submission_path'],
- array(
- 'query' => array(
- 'search' => urlencode($search-term),
- ),
- ),
- );
- $form['#submit'][] = 'mymodule_search_callback'
- function mymodule_search_callback() {
- $form_state['redirect'] = current_path() . and your urlencoded serch term;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement