473,405 Members | 2,154 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

PHP Two Search boxes

Hi

I have two search boxes with one submit button

I want one search box to search one table in my database and the other search box to search another table in my database

Then If there is a match between the two I want the results to be displayed

THANKS!

James

Expand|Select|Wrap|Line Numbers
  1. <form action="today.php" method="post">
  2. <input type="text" name="search">
  3. <input type="text" name="search2">
  4. <input type="submit">
  5. </form>
  6. <hr width="100%"></hr>
  7.  
  8. <?php
  9. if(strlen(trim($_POST['search'])) > 0) {
  10. //all of your php code for the search
  11.  
  12.    $search = "%" . $_POST["search"] . "%";
  13.  
  14.  
  15.   mysql_connect ("", "", "");
  16.   mysql_select_db ("");
  17.  if (!empty($_POST["search_string"])) 
  18.    { 
  19.  
  20.    }  
  21.   $query = "SELECT title,location,msg FROM job_tit,job_loc WHERE (job_title.msg_id=job_loc.msg_id)"; 
  22.  
  23.  
  24.   $result = mysql_query ($query);
  25.   if ($result) {
  26.     while ($row = mysql_fetch_array ($result)) {
  27.       echo "<br>$row[0]<br/>";
  28.       echo $row[1];
  29.       echo "<br>$row[2]<br/><br><br/>";
  30.  
  31.     }
  32.   }
  33. }
  34. ?>
  35. </body>
  36. </html>
  37.  
Aug 19 '11 #1
1 1101
dlite922
1,584 Expert 1GB
What do you mean by match between the two?

For exmaple:

foo = is search term 1
bar = is search term 2

You have two tables: tA and tB.

You have 4 possible outcomes:

foo is found only in tA
bar is found only in tB
foo is found in tA and bar is found in tB
Neither foo nor bar are found in their respective tables.

Is the data found in the two tables related? Do they have common info, i.e. same fields?


Dan
Aug 24 '11 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: misschristalee | last post by:
I'm having a brain blockage day.... Scenario: Search Form with 6 text boxes Query has same six fields Each has this IIF: IIf(IsNull(!!),"",!!) with each dictating the correct text box of...
4
by: visionstate | last post by:
Hi there, I'm fairly new to access and the way it works and I have been building a relatively simple database. It is basically a database where staff members can search for what training they (or...
12
by: ljungers | last post by:
I'm on the home streach of my project and found that my "Reset for New Search" command button not working as desired. What should happen is that when the button is clicked a Event Procedure is run....
4
by: DavidB | last post by:
OK folks I am having a serious brain fart here and can't get the code to do what I really want done. I have a form that has a multi-table query as its data source. The data is dsplayed on the...
6
by: woodey2002 | last post by:
Hi Everyone. Thanks for your time. I am trying to create a search form that will allow users to select criteria from multiple multi select boxes. So far i have managed to achieve a search option...
1
by: woodey2002 | last post by:
Hi Everyone and many thanks for your time.. I am trying to begin access and a bit of VBA i am enjoying it but I have a annoying problem I just can’t get any where on. My databse mostly includes...
8
by: hollinshead | last post by:
Hi there i have bit of an issue. i haver this database that is purely used for searching records under certain criteria. This criteria is chosen by the user on a form using list boxes and combo...
2
by: hollinshead | last post by:
hi there, i have been having this issue for quite some time now and i cant seem to get my head around it. I am trying to create a database for candidates CV's and covering letters. basically the data...
8
by: munkee | last post by:
Hi everyone, I am using the following code adapted from Allen Browne: 'Purpose: This module illustrates how to create a search form, _ where the user can enter as many or few...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.