如何将从数据库中检索到的PHP变量从一个php页面传递到另一个php页面

时间:2016-12-12 14:44:07

标签: javascript php

<?php

$con = new mysqli('localhost','root','','practice');

if($con->connect_error)
{
	echo "".connect_error;
}

$quer = "select * from form";

$result= $con->query($quer);
echo "<h1>Edit/Remove</h1>";
echo "<table border=1><tr><th>Firstname</th><th>Lastname</th><th>Email</th><th>Password</th><th>Month</th><th>Day</th><th>Year</th>
<th>Gender</th><th>Telugu</th><th>Hindi</th><th>English</th>
<th>Mobile</th><th>Location</th><th>Edit</th><th>Delete</th></tr>";
if($result->num_rows >0)
{
	while($row = $result->fetch_assoc())
	{
		echo "<tr>";
		echo "<td>".$row['Firstname']."</td>"."<td>".$row['Lastname']."</td>"."<td>".$row['Email']."</td>"."<td>".$row['Password']."</td>"."<td>".$row['Month']."</td>"."<td>".$row['Day']."</td>"."<td>".$row['Year'].
		"</td>"."<td>".$row['Gender']."</td>"."<td>".$row['Telugu']."</td>"."<td>".$row['Hindi']."</td>"."<td>".$row['English']."</td>"."<td>".$row['Mobile']."</td>"."<td>".$row['Location']."</td>";
		 echo "<td><form method='post' action='update.php' ><input type='hidden' name= 'email' value='".$row['Email']."'><input type='submit' value='edit'>
		 </form></td>"."<td><form method='post' action='delete.php' ><input type='hidden' name= 'email' value='".$row['Email']."'><input type='submit' value='delete'>
		 </form></td>";
	    echo "</tr>";
	}
}
echo "</table>";
echo "<br>";
echo "<br>";
echo "<br>";
echo "<a href='form.html'>Home</a>";
$con->close();
?>
我已经在使用php从数据库检索到的表单中创建了一个编辑/删除选项。我可以使用javascript执行此操作。

我想用代码替换代码中的表单标签并使用onclick执行操作 - 我可以在没有jQuery或json的情况下执行此操作吗?

0 个答案:

没有答案