<tbody id="ajax_fresh">
<?php
$p_id=$_GET["p_id"];
$k=1;
$i = 1;
$sql_pdetails="select * from tb_party_rate_entry where party_id='$p_id'";
$query_pdetails=mysql_query($sql_pdetails);
while($row_pdetails=mysql_fetch_array($query_pdetails))
{
?>
<tr >
<td><?php echo $i++ ; ?></td>
<td> <input type="text" style="width:100px; height:22px; float:left; margin:0px 0px 0px 0px;" name="new_price[]" class="new_price" id="newprice<?php echo $i;?>" rel="<?php echo $i;?>" value="<?php echo $row_pdetails["price"]; ?>" /></td>
<td><input type="text" style="width:70px; height:22px; float:left; margin:0px 0px 0px 0px;" name="org_price[]" class="" value="<?php echo $row_pdetails["org_price"]; ?>" readonly/></td>
<td><input type="text" style="width:70px; height:22px; float:left; margin:0px 0px 0px 0px;" name="yield" class="" value="<?php echo $row_pdetails["yield"]; ?>"/></td>
<td></td>
</tr>
<?php
$i++;
} ?>
</tbody>
这个PHP代码正在获取值并显示id的数据....现在在这个表的顶部我已经应用了一个选择框,我希望每当我从该选择框中选择一个id然后它应该显示对应于那个id的数据..为此我已经应用了像这样的onchange事件....
<option value="">Select Rate Type</option>
<?php
$sql_party_name="select * from tb_party";
$query_party_name=mysql_query($sql_party_name);
while($row_party_name=mysql_fetch_array($query_party_name))
{
?>
<option value='<?php echo $row_party_name["party_id"]; ?>'><?php echo $row_party_name["party_name"]; ?> </option>
<?php } ?>
</select>
the ajax code is as follows..
<script type="text/javascript">
function data(id)
{
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("ajax_fresh").innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("GET","ajax/getinfo.php?cat_id="+id,true);
xmlhttp.send();
}
</script>
the page where ajax is going is
<tbody id="ajax_fresh">
<?php
$p_id=$_GET["cat_id"];
$k=1;
$i = 1;
$sql_pdetails="select * from tb_party_rate_entry where party_id='$p_id'";
$query_pdetails=mysql_query($sql_pdetails);
while($row_pdetails=mysql_fetch_array($query_pdetails))
{
?>
<tr>
<td><?php echo $k++ ; ?></td>
<td><input type="text" style="width:100px; height:22px; float:left; margin:0px 0px 0px 0px;" name="new_price[]" class="new_price" id="newprice<?php echo $i;?>" rel="<?php echo $i;?>" value="<?php echo $row_pdetails["price"]; ?>" /></td>
<td><input type="text" style="width:70px; height:22px; float:left; margin:0px 0px 0px 0px;" name="org_price[]" class="" value="<?php echo $row_pdetails["org_price"]; ?>" readonly/></td>
<td><input type="text" style="width:70px; height:22px; float:left; margin:0px 0px 0px 0px;" name="yield" class="" value="<?php echo $row_pdetails["yield"]; ?>"/></td>
<td></td>
</tr>
<?php } ?>
</tbody>
当我从选择框中选择一个选项...它会显示与其对应的值但是当我点击按钮更新时,它应该插入使用ajax加载的值....但是当我点击时更新按钮....它没有插入任何值...我想插入当我调用ajax时已加载的值...这是我的代码...请帮助我...