Table Layout
Category Table:
CategoryID | CategoryDetails
Subcategory Table:
SCategoryID | CategoryID | SCategoryDetails
Company Table:
companyID | CategoryID | SCategoryID | cname | cweb | cadd | ccity | cstate | country
index.php
<?php
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
include_once 'config.php';
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" href="stylecom.css" type="text/css"></link>
<title>Dynamic Dependent Select Box using jQuery and PHP</title>
<script type="text/javascript" src="jquery-1.4.1.min.js"></script>
<script type="text/javascript">
$(document).ready(function()
{
$(".country").change(function()
{
var id=$(this).val();
var dataString = 'id='+ id;
$.ajax
({
type: "POST",
url: "get_subcat.php",
data: dataString,
cache: false,
success: function(html)
{
$(".state").html(html);
}
});
});
$(".state").change(function()
{
var id=$(this).val();
var dataString = 'id='+ id;
$.ajax
({
type: "POST",
url: "get_com1.php",
data: dataString,
cache: false,
success: function(html)
{
$(".city").html(html);
}
});
});
});
</script>
<style>
</style>
</head>
<body>
<center>
<div>
<label>Category :</label>
<select name="country" class="country">
<option selected="selected">--Select Category--</option>
<?php
$stmt = $dbo->prepare("SELECT * FROM category");
$stmt->execute();
while($row=$stmt->fetch(PDO::FETCH_ASSOC))
{
?>
<option value="<?php echo $row['CategoryID']; ?>"><?php echo $row['CategoryDetails']; ?></option>
<?php
}
?>
</select>
<label>SubCategory :</label> <select name="state" class="state">
<option selected="selected">--Select SubCategory--</option>
</select>
<!---<label>Company :</label>
<select id="form" name="city" class="city">
<option selected="selected">--Select Company--</option>
</select>----->
<br />
</div>
</center>
<table name="city" class="city">
</body>
</html>
get_subcat.php
<?php
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
include('config.php');
if($_POST['id'])
{
$id=$_POST['id'];
$stmt = $dbo->prepare("SELECT * FROM subcategory WHERE CategoryID=:id");
$stmt->execute(array(':id' => $id));
?><option selected="selected">Select Subcategory :</option><?php
while($row=$stmt->fetch(PDO::FETCH_ASSOC))
{
?>
<option value="<?php echo $row['SCategoryID'
. '']; ?>"><?php echo $row['SCategoryDetails']; ?></option>
<?php
}
}
?>
get_com.php
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="stylecom.css" type="text/css">
</head>
<body>
<?php
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
include('config.php');
if($_POST['id'])
{
$id=$_POST['id'];
$stmt = $dbo->prepare("SELECT * FROM company WHERE SCategoryID=:id");
$stmt->execute(array(':id' => $id));
?>
<option selected="selected">Select Company :</option>
<?php
while($row=$stmt->fetch(PDO::FETCH_ASSOC))
{
?>
<!---<option value=</option>--->
<table class="city"><tr>
<td><?php echo $row['cname'];?></td>
<td><?php echo $row['cweb'];?></td>
<td><?php echo $row['ccity'];?></td>
<td><?php echo $row['cstate'];?></td>
<td><?php echo $row['czip'];?></td>
<td><?php echo $row['ccountry'];?></td>
</tr></table>
<?php
}
}
?>
</body>
</html>
index.php
& other php file working fine.
I just make changes all of my code and want to paginate the table in get_com.php how the project is working when I click category, the subcategory dropdown populate and related company table will come.I want to paginate this table
Thanks
If anybody can help?