如何根据Html中选定的下拉值显示Php中的值? [英] How Can I Display A Value In Php Based On The Selected Dropdown Values In Html?

查看:82
本文介绍了如何根据Html中选定的下拉值显示Php中的值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<html>
<head>
<h4>Job Search</h4>	
  <script type="text/javascript"></script>
  <script src="../js/jquery-1.9.1.js"></script>
<script>
  jQuery(document).ready(function() 
  {
    jQuery.ajax(
    {
      type: 'GET',
      url: 'sample.php',
      dataType: 'JSON',
      success:function(data)
      {
        for(i=0;i<jquery(data).length;i++)>
        {
          jQuery('#jobcategory').append('<option value = '+ data[i].jobcategory+'>' + data[i].jobcategory + '</option>');
        }
      }
    });
  });
</script>

<script>
  jQuery(document).ready(function() 
  {
    jQuery.ajax(
    {
      type: 'GET',
      url: 'sample.php',
      dataType: 'JSON',
      success:function(data)
      {
        for(i=0;i<jquery(data).length;i++)>
        {
          jQuery('#jobtype').append('<option value = '+ data[i].jobtype+'>' + data[i].jobtype + '</option>');
        }
      }
    });
  });
</script>

<script>
  jQuery(document).ready(function() 
  {
    jQuery.ajax(
    {
      type: 'GET',
      url: 'sample.php',
      dataType: 'JSON',
      success:function(data)
      {
        for(i=0;i<jquery(data).length;i++)>
        {
          jQuery('#company').append('<option value = '+ data[i].company+'>' + data[i].company + '</option>');
        }
      }
    });
  });
</script>
</head>
<body>
  <form>
  <div>
   Job Categories:<select id="jobcategory">
    <option>Select Job Category</option>
    </select><br><br>

    Job Type:<select id="jobtype">
    <option>Select Job Type</option>
    </select><br><br>

    Company:<select id="company">
    <option>Select Company</option>
    </select><br><br>

    Start Date:<input type="date" class="startdate"><br><br>

    End Date:<input type="date" class="enddate"><br><br>

    No. Of Jobs:<select class="jobcount">
    <option>Select</option>
    <option>5</option>
    <option>10</option>
    <option>15</option>
    <option>20</option>
    </select><br><br>

    <input type="button" id="search" value="search">

    </br></br></br></br></br></br></br></br></br></br></br></br></div>

//1.Once i select the values in drop down i need to send the selected values to PHP. Based on the values i need to filter the jobs present in the DB.

//2.Then i need to display the job in a div using jQuery template.


    <div id="job_listing" style="" class="jobs_list">
      texttexttexttexttexttexttexttexttexttexttext
    </div>
  </form>
</body>
</html>

推荐答案

应该在MYSQL选择查询中使用LIMIT。
Should use LIMIT in the MYSQL select query.


这篇关于如何根据Html中选定的下拉值显示Php中的值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆