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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T05:15:40+00:00 2026-05-23T05:15:40+00:00

I am new to codeigniter, I am adding a search function to the site,

  • 0

I am new to codeigniter, I am adding a search function to the site, and had two questions.

  1. How would I submit a form so that it would be sent as uri segments (like a query string)? I did it before by submitting with post, and redirecting to a url with it in the uri segments. But is there a better way?
  2. How would I send a string (such as a search query, completely user-generated) through a uri segment? I tried urlencode, but there were still characters that weren’t allowed. I want to keep the bulk of what the query is (so it is easily found in say history, so no base64_encode). Thoughts? Is there a built-in function for this or something?

Thanks for any help,
Max

  • 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-23T05:15:41+00:00Added an answer on May 23, 2026 at 5:15 am

    You would use JavaScript to form the URL, like this:

    <form onsubmit="window.location.href='/search/'+encodeURIComponent(document.getElementById('search_query').value);return false">
        <input id="search_query" type="text" />
        <input type="submit" />
    </form>
    

    EDIT: The above answer will not work because of CodeIgniter’s URI filter. However, from my experience with version 1.7, if you pass more than one GET parameter, you can retrieve them using the $_REQUEST array. This will bypass the URI filter altogether. So do this:

    <form action="/search">
        <input name="x" type="hidden" />
        <input name="q" type="text" />
        <input type="submit" />
    </form>
    

    Then use $_REQUEST[‘q’] to get your search query. Hopefully this will work for you.

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

Sidebar

Related Questions

I'm new to CodeIgniter. Previously I had developed a login script that would make
I am developing a new project in CodeIgniter (CI), and would like to find
I'm still very new to codeigniter. The issue i'm having is that the file
I'm new to CodeIgniter. I notice that all CodeIgniter folders (cache, config, controllers, core,
I'm new to CodeIgniter and I hope that my question will have a simple
New to HMVC in Codeigniter. Dynamic form allows new segments to be created when
I am building an application with codeigniter that involves adding a carer with multiple
I am relatively new to codeigniter and am struggling to understand how would save
I am new to codeigniter and i am installing this shopping cart that is
I m new to CodeIgniter so i m facing some problem regarding adding contents

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.