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

The Archive Base Latest Questions

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

I have created a search form that I want to forward on submit. The

  • 0

I have created a search form that I want to forward on submit.

The way it should work is the user enters the term/keyword they want to search for, the form will then forward them to /search/$keyword

My research has let me to the conclusion that the form needs to be posted to the controller then do the forwarding from there. But I have tried numerous times and can’t get it to forward.

Here is the form:

<?php echo form_open('search'); ?>
            <input id="search_text" name="searchquery" type="text" value="enter your search here..." onfocus="if(this.value == 'enter your search here...') this.value='';" onblur="if(this.value == '') this.value='enter your search here...';" maxlength="120" >
       <?php echo form_close();?>

And the controller:

if($this->input->post('searchquery')){
 redirect('search', $this->input->post('searchquery'));
}
  • 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:45:40+00:00Added an answer on May 26, 2026 at 12:45 pm

    change this line:

    redirect('search', $this->input->post('searchquery'));
    

    to:

    redirect('search/' . $this->input->post('searchquery'));
    

    In your redirect call, the second parameter is the “method” of redirection, so that’s why your redirect is not working. what you want is something like this:

    redirect('search/my+search+term');
    

    That’s why we do the string concatenation, instead of passing the search term to the second parameter.

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

Sidebar

Related Questions

I have created a keyword search in SQL that takes a list of keywords
I have created my application that has search form and below contains results for
I have created a search bar for my website, the user may search a
Good Morning, I have created an ASP.NET 3.5 webform that allows users to search
I have created a search form with get method. But when the url looks
I have a form created which an unbound datagridview that has three columns. Position,
I have created an HTML form with a search box and a drop down
I have a search form that searches a table in my database. The table
I want to create a really simple search form, basically a single field, that
I currently have multiple search fields within one form which the user can pick

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.