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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T17:42:54+00:00 2026-06-02T17:42:54+00:00

I have a site that offers a keyword search. The user can perform a

  • 0

I have a site that offers a keyword search. The user can perform a search by either selecting from a set of pre-defined keywords displayed as hyperlinks or utilize a search form on the same page.

When the user searches for Russian Blue Cat, the following is added to the page URL:

If using the pre-defined hyperlink search term, then ?keywords=Russian%20Blue%20Cat is added to the URL as follows:

  http://mydomain.com/index.php?keywords=Russian%20Blue%20Cat

If using the search form, then ?keywords=Russian+Blue+Cat is added to the URL as follows:

 http://mydomain.com/index.php?keywords=russian+blue+cat

The following $_GET line of code is placed within two PHP files, the original index.php file that contain both the pre-defined hyperlink search terms and the search form and another PHP file called process.php that utilizes the keywords for another process.

  if(empty($_GET['keywords'])){$keywords = '';} else {$keywords = $_GET['keywords'];}

The above $_GET line of code contained within the index.php file works properly and retrieves all three keywords. In this case the words Russian Blue Cat is retrieved.

The above $_GET line of code contained within the process.php file does not work properly and only retrieves the first of the three keywords. In this case only the word Russian is retrieved.

Is there a simple or proper way to fix this such that all keywords are retrieved properly?

Thank you in advance.

  • 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-02T17:42:55+00:00Added an answer on June 2, 2026 at 5:42 pm

    Check for the string ‘%20’ and if present, explode by ‘%20’. Otherwise, check for the presence of a plus sign and explode by it instead.

    This method is agnostic of the differing input format from the two sources entering the same script.

    The caveat is that the string ‘%20’ or the character ‘+’ cannot occur inside a word in the other format or you will get unusual behavior.

    $keyword = array();
    if(stripos($keywords,"%20")) {
        $keyword = explode("%20",$keywords);
    }
    else if(stripos($keywords,"+")) {
        $keyword = explode("+",$keywords);
    }
    

    ‘$keyword’ will then contain your keywords in an array.

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

Sidebar

Related Questions

I have a site where there will be a list of offers that the
I have a site that can be accessed both through http (http://mysite.com) and https
I have a site that can allow me to access the mobile version of
I have a site that has a /sites/default/files/ directory where user content is typically
We have a site that offers very large files for download to clients. These
There's a site that offers a search service. You enter a number, search, and
Argghh. I have a site that offers audio previews of songs hosted elsewhere. Some
I have a site that loads CSS and fonts from Google Web Fonts .
I have a site that i want to redirect all requests accept for 1
I have a site that allows download or streaming of mp3 files. All the

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.