<head>
<script> src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript">
$(function(){
$('#combo').change(function(){
console.log($(this));
var sqlQuery = "SELECT product_name='combo' from product_master where mrp='textbox'";
var result = dbConn.executeCachedQuery(sqlQuery);
$.get("abc.php");
$('#combo').change(function(){ $('#textbox').val($(this).val()); });
}) ;
});
</script>`
</head>
<body>
<form>
<select name="combo" id="combo">
<option value="">-- Select</option>
<?php
require_once("connect.php");
$query="select * from product_master";
$result=mysql_query($query);
while ($row = mysql_fetch_array($result)) {
echo '<option value = "' . $row['product_name'] . '">' . $row['product_name'] . '</option>';
}
?>
</select>
<input type="textbox" id="textbox" value="<?php $row['mrp']; ?>" />
</form>
</body>
我想从数据库中选择从组合框到文本框中的数据库。PHP组合框到文本框从数据库中获取值
相同的产品名称取mrp。产品名称组合框和mrp文本框一旦选择组合需要取回相同的mrp。
使用AJAX来获取数据,然后在组合框中 –
使用DOM发生后数据的价值某些网页,使用Ajax或jQuery的岗位(),得到响应和文本框中填写 –
'\t ID \t INT(11)\t \t \t \t PRODUCT_NAME \t VARCHAR(200) \t组\t VARCHAR(100)\t \t MRP INT(100)' – Rajesh