134
rated 0 times
[
139]
[
5]
/ answers: 1 / hits: 8184
/ 10 Years ago, thu, september 4, 2014, 12:00:00
Hi i am using php where i am using ajax i am retrieving data from database without reloading page i am getting data on same page now i want that when i get data i retrieve in table format then there is update button there when i click on update button a new form should open
Here is code
index.php
<html xmlns=http://www.w3.org/1999/xhtml>
<head>
<meta http-equiv=Content-Type content=text/html; charset=utf-8 />
<title>Untitled Document</title>
<script type=text/javascript>
function fun()
{
var exam=new XMLHttpRequest();
exam.onreadystatechange=function()
{
if(exam.readyState==4)
{
document.getElementById(res).innerHTML=exam.responseText;
}
}
exam.open(GET,rat_test.php?name=pramod,true);
exam.send(null);
}
</script>
</head>
<body>
<form action= method=post id=form name=form>
<table>
<tr>
<td></td><td><input type=button onclick=fun(); value=getvalue />
</td></tr>
<div id=res></div>
</table>
</form>
</body>
</html>
rat_test.php
<table border=1>
<tr>
<th scope=col>ID</th>
<th scope=col>Name</th>
</tr>
<?php
include(connection.php);
$sel=select * from info;
$res=mysql_query($sel);
while($fet=mysql_fetch_array($res))
{ ?>
<tr>
<td><input type=checkbox name=users[] value=<?php echo $row[id]; ?> ></td>
<td><?php echo $fet['id']; ?></td>
<td><?php echo $fet['name']; ?></td>
</tr>
<?php }
?>
</table>
<form action= method=post id=form name=form>
<table>
<tr>
<td></td><td><input type=button onclick=fun()1; value=Update />
</td></tr>
</table>
</form>
here in test_rat.php a update button is available i want to open a new form on that update button button
How can i achieve this
Any help will be appreciated
More From » php