SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Feb 2012
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    To search data according to input from 3 fields from 3 tables.

    HTML Code:
    <form name="search" action="" enctype="multipart/form-data">
       <table width="100px" border="0"  cellpadding="2" class="table" style="float:left;">
      <tr align="center" valign="middle" bgcolor="#CCCCCC">
         <td><strong>From Date</strong></td>
         <td><input type="text" name="from_date1" id="from_date1" readonly="1" />
         <script type="text/javascript">
            function catcalc(cal) {
            var date = cal.date;
            var time = date.getTime()
            // use the _other_ field
            var field = document.getElementById("from_date1");
            if (field == cal.params.inputField) {
                field = document.getElementById("from_date1");
                }
                //field.value = date2.print("%d-%m-%Y");
        }
        Calendar.setup({
            inputField     :    "from_date1",   // id of the input field
            ifFormat       :    "%Y-%m-%d",       // format of the input field
            showsTime      :    false,
            timeFormat     :    "24",
            onUpdate       :    catcalc
        });
    </script>
         
         </td>
         <td><strong>To Date</strong></td>
         <td><input type="text" name="to_date1" id="to_date1" readonly="1" />
         <script type="text/javascript">
         function catcalc(cal) {
            var date = cal.date;
            var time = date.getTime()
            // use the _other_ field
            var field = document.getElementById("to_date1");
            if (field == cal.params.inputField) {
                field = document.getElementById("to_date1");
                }
        }
        Calendar.setup({
            inputField     :    "to_date1",   // id of the input field
            ifFormat       :    "%Y-%m-%d",       // format of the input field
            showsTime      :    false,
            timeFormat     :    "24",
            onUpdate       :    catcalc
        });
    </script>
         </td>
         <td><strong>Employee Type</strong></td>
         <td>
        <select name="emp_type_id1" id="emp_type_id1">
            <option value="0">---Select---</option>
             
              <option value="1">Executive</option>
              <option value="2">Non-Executive</option>
              </select>
         </td>
         <td><input name="Search" type="submit" value="Search"/></td>
      </tr>
    </table>
    </form>

    Here i want that user will search according to the three fields and clicking on search button will show the employee names .But the data has to retrieved from 3 tables, as my from-date and to_date is in another table and employee-type is in another table and employee-name is in another table, but in three tables emp_id is common.

    And i want to show the data in the same page.
    Last edited by SpacePhoenix; Feb 13, 2012 at 02:55. Reason: placed html tags around code

  2. #2
    Twitter: @AnthonySterling silver trophy AnthonySterling's Avatar
    Join Date
    Apr 2008
    Location
    North-East, UK.
    Posts
    6,111
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    ... and how are these tables structured?
    @AnthonySterling: I'm a PHP developer, a consultant for oopnorth.com and the organiser of @phpne, a PHP User Group covering the North-East of England.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •