how to get value of 'slct_s' plz help me.
Posted: Tue Jun 04, 2013 2:40 am
[text]
Code: Select all
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" >
<title>PHP-Ajax, Country State City</title>
<script type="text/javascript" src="http://ajax.googleapis.com/
ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function()
{
$("#cat").change(function()
{
var dataString = 'id='+ $(this).val();
$.ajax
({
type: "POST",
url: "product1.php",
data: dataString,
cache: false,
success: function(html)
{
$("#scat").html(html);
}
});
});
});
</script>
</head>
<body>
<?php
include_once("library/function/function.php");
include_once("library/function/model.php");
include_once("library/function/image_class.php");
check_admin();
$x=new Model();
$x->get_all_cat();
include_once("logout.php");
include_once("admin_menu.php");
?>
<fieldset style="width: 600px;"><legend>Add Product</legend>
<form action="" method="post" enctype="multipart/form-data">
<table>
<tr><td>Category</td><td><select name="slct" id="cat"><option>Select</option>
<?php
if(count($x->ids)>0)
{
for($i=0;$i<count($x->ids);$i++)
{
echo "<option value='".$x->ids[$i]."'>".$x->nm[$i]."</option>";
}
}
?>
</select></td></tr>
<tr><td>Sub_Category</td><td><select name="slct_s" id="scat"><option>Select</option>
</select>
</td></tr>
<tr><td>Title</td><td><input type="text" name="pname" /></td></tr>
<tr><td>Price</td><td><input type="text" name="pp" /></td></tr>
<tr><td valign="top">Description</td><td><textarea name="desc" style="resize: none;"></textarea></td></tr>
<tr><td>Image</td><td><input type="file" name="pi" id="sf" ></td></tr>
<tr><td colspan="2" align="right"><input type="submit" name="submit" value="add" /></td></tr>
</table>
</form>
</fieldset>
</body>
</html>
<?php
if(isset($_POST['submit']))
{
$z=$_POST['slct_s'];
echo $z;
}
?>