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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T23:22:05+00:00 2026-05-23T23:22:05+00:00

I have put together a very complicated search form. Using arrays I have managed

  • 0

I have put together a very complicated search form. Using arrays I have managed to get it searching by checkboxes.

if(isset($_POST['search']) && !empty($_POST['search'])){
foreach($_POST['search'] as $key=>$value){
    if($value==1) $search[] = "$key";
}
$searchstring = implode(' AND ', $search);

}

        $query = "SELECT candidate_id.master_id, candidate_contact_details.first_name, candidate_contact_details.last_name, candidate_contact_details.home_phone, candidate_contact_details.work_phone, candidate_contact_details.mobile_phone, candidate_contact_details.email FROM candidate_id, candidate_contact_details, qualifications, security_experience, previous_career WHERE qualifications.active = 'finished' and candidate_id.master_id = candidate_contact_details.c_id and candidate_id.master_id = qualifications.c_id and $searchstring";

I know how to do searches of the database by a specific term. ie. postcode field but does anyone know how I can add that to this query? I know how to do either checkbox based searches or text field based searches but cannot figue out how to combine the two.

Thanks Again
Jason

  • 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-23T23:22:06+00:00Added an answer on May 23, 2026 at 11:22 pm

    As far as I can understand your question, you need to map the names of the form fields to database columns. You could set up an array like:

    $post_map = array(
        'home_phone' => 'candidate_contact_details.home_phone',
        'first_name' => 'candidate_contact_details.first_name',
        // etc.
      );
    

    Then you could add things to your query like (just an untested example…):

    foreach ($_POST as $key => $value)
    {
      if (array_key_exists($key, $post_map))
      {
         $search[] = $post_map[$key] . '=' . mysql_real_escape_string($value);
      }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have put together a script which is very much like the flickr photostream
I have put together a small ASP.NET MVC 2 site that does some very
I am very new to MySQL joins and I have put this together, it
I have a very new site I am trying to put together and it
I have put together the following mootools script window.addEvent('domready', function() { var shouts =
Greetings: I have put together a RESTful web service in .NET 3.5 that takes
I have a utility that I put together that uses the .NET Framework to
I have put together a script which will upload a CSV file and then
I'm trying to put together a very simple REST-style interface for communicating with our
ok, so I put together a very basic mail function and while testing this,

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.