Fastest Web Hosting

could you help me fetch records from a mysql table using two dropdown on webpage

0 votes
asked Jul 6, 2016 in PHP by rohit (2,750 points)

I am creating a webpage where user can track his order courier status by just select two values name and date

My Cms is automatically saved courier track order in database table. Simply i want to fetch that result on based selected two values from dropdown ..

1 Answer

0 votes
answered Jul 6, 2016 by rajatinsa (3,350 points)

You can develop it via two method
1 : Via Ajax
2 : Submit form

I am explaying you ajax based search on based by name..You will have to add name dynamically via sql or etc.

<?php
if($_POS['name'] !='')
{
  /*fetch & print record from table via sql or just print and don't forget die() function before } closing bracket of if condition*/
}
?>

<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
 $('.submit_button').live("click",function()
    	{
    			var name = $('name').val();
    			var date= $('date').val();
    
    			var datastring='name='+name+'&date='+date;
    			$.ajax({
    			type: "POST",
    			url: "serverfile.php",
    			data: datastring,
    			cache: false,
    			success: function(ht){
    				$("#result").html(ht);
    				}
    			});
    			return false;
    	});

</head>
<body>
<select id="name"><option>Name 1</option><option>Name 2</option></select>

<div id="result"></div>
</body>
</html>
   

Job Board

TechnicalSharp is a technical community of developers where they are sharing their knowledge and solutions and against it they are getting the score point which help them to make profile strong which is under eyes on MNC's
...