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 6748565
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T12:34:50+00:00 2026-05-26T12:34:50+00:00

I have a form that posts a search query to my ‘search’ controller: <div

  • 0

I have a form that posts a search query to my ‘search’ controller:

<div id="search_box">
<?php echo form_open('search'); ?>
<?php echo form_input('searchvalue', 'search...'); ?>
<?php echo form_submit('submit', 'Search!'); ?>
<?php echo form_close(); ?>
</div>

In my search controller I have the following code:

  public function index()
    {
           $page = 'search';
        $category = 'search';

         if($this->input->post('searchvalue')) {
                  redirect('search/query');
         };


......

}

My problem is that it won’t do the redirect. I have the form helper autoloaded. What can I do to solve this mystery. Is it a case for the batman?

  • 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-26T12:34:51+00:00Added an answer on May 26, 2026 at 12:34 pm

    In Codeigniter if you ask for a POST variable from the Input class it will return the value or FALSE if the value is empty (Personal Experience) or not found.

    So Maybe instead put in a Hidden field with a Dummy value and just check for that on each submit. You can then perform validation and redirect. This will then work if the search query is provided or not.

    And the ; after you if is not valid PHP.

    For Example:

    <div id="search_box">
    <?php echo form_open('search'); ?>
    <?php echo form_hidden('mysearchform', 'true'); ?>
    <?php echo form_input('searchvalue', 'search...'); ?>
    <?php echo form_submit('submit', 'Search!'); ?>
    <?php echo form_close(); ?>
    </div>
    
    public function index() {
    
    $page = 'search';
    $category = 'search';
    
    if($this->input->post('mysearchform') != FALSE) {
    
        // Remember to Validate your Query
    
        redirect('search/query');
    }
    
    }
    

    Hope I understood that correctly.

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

Sidebar

Related Questions

i have a form that have a field which hold query for search and
I have got a form that posts values to a page in a wizard.
I have a html form that posts to a new page on submit. If
I have a search form field that I want to compare with multiple columns
I have a search form that can search in different provider. I started out
i have defined a route as below: context.MapRoute(SearchEngineWebSearch, search/web/{query}/{index}/{size}, new { controller = search,
I have a search feature using PHP that offers either the option to search
I have a php script that takes the individual characters entered into a form
Currently I've got a PHP page query.php with a form that presents a list
The basics: I have a contact form that uses php to validate the forms.

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.