title: Search data from multiple tables using sql query
body: <p>In mysql Database I've following tables and html search form. Now I want to search selected data <strong>(From Search Form)</strong> from multiple tables. Selected data could be <code>gender</code>, <code>budget</code>or <code>location</code>. For location I've 7 tables. <strong>(No. 2-8)</strong> and each 7 tables second column value could be <code>0</code> OR  <code>1</code> when user signup as there Location.So in this Location field user can select Central or East Or West or...others when searching. </p>
  
  <p>So how do I write a sql query ( or Sql Join Query) to get the result from Mysql tables for search ?</p>
  
  <p><strong>Php Variable :</strong></p>
  
  <pre><code>$gender = inputvalid($_POST['gender']);
  $budget = inputvalid($_POST['budget']);
  $location = inputvalid($_POST['location']);
  </code></pre>
  
  <p><strong>Table name with column name</strong></p>
  
  <pre><code>1. tutor_signup_form        (tutor_id, gender, feerange, name, email)
  2. tutor_signup_pre_central (tutor_id, pre_c_central, place1, place2, place3)
  3. tutor_signup_pre_west    (tutor_id, pre_w_west, place1, place2, place3)
  4. tutor_signup_pre_east    (tutor_id, pre_e_east, place1, place2, place3)
  5. tutor_signup_pre_south   (tutor_id, pre_s_south, place1, place2, place3)
  6. tutor_signup_pre_north   (tutor_id, pre_n_north, place1, place2, place3)
  7. tutor_signup_pre_ne      (tutor_id, pre_ne_northEast, place1, place2, place3)
  8. tutor_signup_pre_nw      (tutor_id, pre_nw_northWest, place1, place2, place3)
  </code></pre>
  
  <p><strong>and I've a search form is look like this:</strong> </p>
  
  <pre><code>&lt;tr&gt;
      &lt;td style="width:100px;"&gt;1. Gender:&lt;/td&gt;
      &lt;td&gt;    
          &lt;select name="gender"&gt;
          &lt;option value=""&gt;--Select--&lt;/option&gt;
          &lt;option value="male"&gt;Male only&lt;/option&gt;
          &lt;option value="female"&gt;Female only&lt;/option&gt;
          &lt;/select&gt;
      &lt;/td&gt;   
      &lt;/tr&gt;
  &lt;tr&gt;
      &lt;td&gt;2. Budget:&lt;/td&gt;
      &lt;td&gt;
          &lt;select name="budget"&gt;
          &lt;option value="" SELECTED&gt;--Select--&lt;/option&gt;
          &lt;option value="90"&gt;$90 and below&lt;/option&gt;
          &lt;option value="80"&gt;$80 and below&lt;/option&gt;
          &lt;option value="70"&gt;$70 and below&lt;/option&gt;
          &lt;option value="60"&gt;$60 and below&lt;/option&gt;
          &lt;option value="50"&gt;$50 and below&lt;/option&gt;
          &lt;option value="40"&gt;$40 and below&lt;/option&gt;
          &lt;option value="30"&gt;$30 and below&lt;/option&gt;
          &lt;option value="25"&gt;$25 and below&lt;/option&gt;
          &lt;option value="20"&gt;$20 and below&lt;/option&gt;
          &lt;option value="15"&gt;$15 and below&lt;/option&gt;
          &lt;option value="10"&gt;$10 and below&lt;/option&gt;
          &lt;/select&gt;
      &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
      &lt;td&gt;3. Location:&lt;/td&gt;
      &lt;td&gt;
      &lt;select name='location'&gt;
      &lt;option value="" SELECTED&gt;--Select--.&lt;/option&gt;
      &lt;option value='1' /&gt;Central City&lt;/option&gt;
      &lt;option value='2' /&gt;East City&lt;/option&gt;
      &lt;option value='3' /&gt;West City   &lt;/option&gt;
      &lt;option value='4' /&gt;South City  &lt;/option&gt;
      &lt;option value='5' /&gt;North City  &lt;/option&gt;
      &lt;option value='6' /&gt;North East  &lt;/option&gt;
      &lt;option value='7' /&gt;North West  &lt;/option&gt;       
      &lt;/select&gt;
      &lt;/td&gt;
  &lt;/tr&gt;
  </code></pre>