This is the code that not getting the result

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
<title>Nice select</title>
<script Language="JavaScript">
function checkData()
    {
    
    var myTest  = me.D1.value;
     //alert(myTest);
	 
	 var req = new Request.JSON({
        url: 'dbselect.php',
        method: 'post',
        data: 'brand=' + encodeURIComponent(myTest)
    });
	 req.addEvent('success', function(response) {
				
			
			var ts = new String(response);
			document.me.inter.value = ts;

      
    });
    req.send();
	 
	 
     }
</script>

</head>

<body>
<form method="POST" name="me" id="me">
    <select size="1" name="D1"  onChange="checkData()">
    <option value="99">Default</option>    
    <option value="1">1</option>
    <option value="2">2</option>
    <option value="3">3</option>
    <option value="4">4</option>
    </select>
    
    <input name="inter" id="inter"  type="text" >
</form>
</body>
</html>

This is the "dbselect.php" this is working well

<?php
include("../init/db.php");
$id=$_POST['brand'];
$sql="SELECT * FROM tea_type
WHERE id = '$id' ";
$data = mysql_query($sql);
while($info = mysql_fetch_array($data)){
	$model = $info['product'];

}
echo json_encode($model);
?>

...var req = new Request.JSON where did you define the Request object? It looks like you forgot to "include/import/ling to" a javascript file!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.