Indian pincode search with location using Php, Jquery and MySql.



In this tutorials I am going to explore you a very useful script for your ecommerce websites. Every online shopping projects and other postal based projects needs this script for their websites . We can see every courier companies provide the location finder using pincode for customers. Customers can also check their pincode for delivery service availability on their location.

We can see also all top eCommerce websites provide this facility for customers to check their pincode before buying products. So that customers can check product is deliverable or not on their location.
So here I am going to show you how to create a location finder script by pincode using php, jquery and mysql.

Here is the output of the page:


download view

Implementation of Database and Tables:

First you need to create a Database indianpincode. After creating database (indianpincode), you will have to create a Table Pincode. Here Table Pincode has four columns ( pincode, courier_company, city_name and state_name). These fields are use to store the Pincode, State Name , City Name and Courier Company Name .

• Pincode.sql: This table contains thousands of rows so i can not show source code of this table. You can download it from this site or you can get it online in Excel Form. You will have to only convert excel file into sql or csv form and import it into your database.

• index.php: In this file I have used Ajax and Jquery Library and some Php code. I have used JavaScript to getting data of pincode, courier name, sate and city from pin_check.php using help of Ajax. It also displays the returned HTML of pin_ckeck.php file.

      <title>Indian pincode search with location and courier services</title>
      <script type="text/javascript" src="script.js"></script>
      <link rel="stylesheet" href="style.css" />
      <script type="text/javascript" src=""></script>

<script type="text/javascript">
$("#check").click(function() {
var name = $('#name').val();
type: "POST",
url: "pin_check.php",
data: "name="+ name ,
success: function(html){
return false;


<h1>Indian Pincode search with location and courier service</h1><br>


<form method="post">
<b style="color:white;">PINCODE SEARCH:</b>
<input style="height:40px; width:200px;" id="name" type="text" name="name" />
<input style="height:40px; width:70px; " id="check" type="submit" name="check" value="check" /><br />

  <div class="tbl-content">
    <table cellpadding="0" cellspacing="0" border="0">
        <h2><?php echo @$_GET['blank']; ?> </h2>
        <div id="disp"></div>

• pin_check.php: In this file I have used MySql query to get data from Pincode table to display pincode, courier name, city, state on page using Ajax and Jquery.


$con = mysqli_connect("localhost","root"," ","indianpincode");

$get="select * from Pincode where pincode='$name' ";

echo "<h2 style='color:white;' >
Courier Company are not providing delivery services at this Pincode: 
<span style='color:red;'>$name</span></h2>";

        <tr style='width:100%'>
          <td style='width:15% color:#f51c4f;'><h3 style='color:black;'>PINCODE</h3></td>
          <td style='width:15%'><h3 style='color:black;'>COURIER COMPANY</h3></td>
          <td style='width:15%'><h3 style='color:black;'>CITY NAME</h3></td>
          <td style='width:15%'><h3 style='color:black;'>STATE NAME</h3></td>
          <td style='width:15%'><h3 style='color:black;'>STATE CODE</h3></td>
          <td style='width:15%'><h3 style='color:black;'>COD</h3></td>
while($row1 = mysqli_fetch_array($query)){
    $pincode = $row1['pincode'];
    $courier = $row1['courier_company'];
    $cityname = $row1['city_name'];
    $statename = $row1['state_name'];
   $statecode = $row1['state_code'];
     $status = $row1['cod'];

        <tr style='width:100%'>
          <td style='width:15%'>$pincode</td>
          <td style='width:15%'>$courier</td>
          <td style='width:15%'>$cityname</td>
          <td style='width:15%'>$statename</td>
          <td style='width:15%'>$statecode</td>
          <td style='width:15%'>$status</td>



The End:

Thank you for reading this article, and if you have any problem, have a another better useful solution about this article, please write message in the comment section. We will be very happy to hear that.

If you like my tutorial, please follow us on facebook, Google + and Twitter. I need your support to continue.