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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T09:39:13+00:00 2026-05-13T09:39:13+00:00

I have created a search form with get method. But when the url looks

  • 0

I have created a search form with get method. But when the url looks like this search.php?search[] or search?search[] (mod_rewrite) then I get a sql fattal error. It’s passing an array and I want to avoid that problem.

my question is how do I redirect a person from that url to search.php

  • 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-13T09:39:13+00:00Added an answer on May 13, 2026 at 9:39 am

    It sounds like you are directly passing the ?search[] query string variable into your SQL. mod_rewrite won’t fix this for you… what if I decide to call your page with http://www.yoursite.com/search.php?search=;DROP TABLE users;? You simply aren’t able to use mod_rewrite to predict all the bad kinds of input that a user can come up with.

    Your code needs to be doing input validation and sanitization. You must assume that everything your script receives from the user is malicious and dangerous. That includes all data inside $_GET, $_POST and $_COOKIE.

    The right solution here is to check that $_GET['search'] is a valid value to be passing to your SQL. Something like:

    if (is_string($_GET['search']) && ! empty($_GET['search']) {
        //escape the input properly using your database-specific method, e.g.:
        $searchParam = mysql_real_escape_string($_GET['search']);
        //run your query with the escaped data
    }
    

    At a minimum, that would ensure that your passed in search variable was not an empty string.

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

Sidebar

Related Questions

I've created a search form for a script in php. Basicaly this form have
I have created a form in my application as follows: <form action=/search/ method=get> <input
I have created a searchfrom.php for wordpress but then it's giving me a false
I have a form, created with Zend_Form, with method = GET used for searching
I have created my application that has search form and below contains results for
I am trying to get this form to submit correctly. Here's what I have
i have created little search method. The problem that its hard to read it
I have created a complex sql server 2008/coldfusion search page, that searches thru a
I have created a search bar for my website, the user may search a
I have created a search feature for a site and in addition I made

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.