我是ajax的新手。我的情况是,我想在同一页面上传递值,所以如果我单击选中的值传递到上部
在我这样的纯php代码上
<?php include('connect.php');
$query="SELECT barang_id, nama, stok, AuUser,AuDate FROM barang";
$result=mysql_query($query);
$num=mysql_numrows($result);
mysql_close();
?>
<table border="1" cellspacing="2" cellpadding="2" >
<tr>
<td><font face="Arial, Helvetica, sans-serif">No.</font></td>
<td><font face="Arial, Helvetica, sans-serif">Barang ID</font></td>
<td><font face="Arial, Helvetica, sans-serif">Nama</font></td>
<td><font face="Arial, Helvetica, sans-serif">Stock</font></td>
<td><font face="Arial, Helvetica, sans-serif">AuUser</font></td>
<td><font face="Arial, Helvetica, sans-serif">AuDate</font></td>
<td><font face="Arial, Helvetica, sans-serif">Select</font></td>
</tr>
<?php
$i=0;$j=1;
while ($i < $num) {
$f1 = mysql_result($result,$i,"barang_id");
$f2 = mysql_result($result,$i,"nama");
$f3 = mysql_result($result,$i,"stok");
$f4 = mysql_result($result,$i,"auuser");
$f5 = mysql_result($result,$i,"audate");
?>
<tr>
<td><font face="Arial, Helvetica, sans-serif"><?php echo $j; ?></font></td>
<td><font face="Arial, Helvetica, sans-serif"><?php echo $f1; ?></font></td>
<td><font face="Arial, Helvetica, sans-serif"><?php echo $f2; ?></font></td>
<td><font face="Arial, Helvetica, sans-serif"><?php echo $f3; ?></font></td>
<td><font face="Arial, Helvetica, sans-serif"><?php echo $f4; ?></font></td>
<td><font face="Arial, Helvetica, sans-serif"><?php echo $f5; ?></font></td>
<td><a href="data.php?id=<?php echo $f1;?>&nama=<?php echo $f2;?>&stok=<?php echo $f3;?>&auuser=<?php echo $f4;?>&audate=<?php echo $f5;?>">Selected</a></td>
</tr>
<?php
$i++; $j = $j + 1;
}?>
<?php
$id1 = ($_GET['id']) ;
$nama1 = ($_GET['nama']) ;
$stok1 = ($_GET['stok']);
$auuser1 = ($_GET['auuser']);
$audate1 = ($_GET['audate']) ;
?>
<div class="tengah">
<form action="doupload.php" method="post">
<div class="kiri">ID </div>
<div class="kanan"><input type="text" name="id" id="id" value="<?php echo $id1;?>"/> </div>
<div class="kiri">nama </div>
<div class="kanan"><input type="text" name="nama" id="nama" value="<?php echo $nama1;?>"/></div>
<div class="kiri"> stock </div>
<div class="kanan"><input type="text" name="stok" id="stok" value="<?php echo $stok1;?><?php echo $id1;?>"/></div>
<div class="kiri">auuser </div>
<div class="kanan"><input type="text" name="user" id="user" value="<?php echo $auuser1;?>"/></div>
<div class="kiri">audate </div>
<div class="kanan"><input type="text" name="date" id="date" value="<?php echo $audate1;?>"/></div>
<div class="kiri"><input name="Submit" type="submit" value="submit" /></div>
<div class="kanan"><input name="Reset" type="reset" value="cancel" /></div>
</form>
<div id="insert_response"></div>
</div>
这是我想使用ajax的问题,所以当我单击表上的选择时。没有加载就在顶部传递的值。谢谢