How to show chosen data row from database in other page?
Posted: Thu Jul 30, 2009 3:47 pm
Hello to everyone,
Could you help me or suggest how to do it: my idea is to show data on other page after clicking the button. Till now i have done is printing a table which has data taken from database. Every row in the end has a button, then this button is pressed i want to take all information in this row and show it in other page. Example: if i choose row number 3, all data from that row has to be printed in other page. Can you suggest or show how to do it?
This is my code:
Thanks for help
Could you help me or suggest how to do it: my idea is to show data on other page after clicking the button. Till now i have done is printing a table which has data taken from database. Every row in the end has a button, then this button is pressed i want to take all information in this row and show it in other page. Example: if i choose row number 3, all data from that row has to be printed in other page. Can you suggest or show how to do it?
This is my code:
Code: Select all
<? session_start();
include ("db.php");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Untiteled</title>
<link href="style.css" rel="stylesheet" type="text/css" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<table width="900" border="0" cellpadding="0" cellspacing="0" class="rem">
<tr>
<td>
<?php
if ($_SESSION['username'])
echo "Hello, ".$_SESSION['username']."!<br><a href='logout'>Logout</a>";
else
echo "You have to <a href='index.php'>log in</a>";
$result = mysql_query("select * from user");
$myrow = mysql_fetch_array ($result);
do
{
printf("<table width='900' border='0' cellpadding='0' cellspacing='0' class='rem'>
<tr>
<td>
</td>
</tr>
<tr>
<td>
<table class='tam' width='900' border='0' cellspacing='0' cellpadding='0'>
<tr>
<td>Number</td>
<td>Name</td>
<td>Last Name</td>
<td>Email</td>
</tr>
</table></td>
</tr>
<tr>
<td><table width='900' border='0' cellspacing='0' cellpadding='0'>
<tr>
<td width='92'>%s</td>
<td width='342'>%s</td>
<td width='157'>%s</td>
<td width='179'>%s</td>
<td><input type='submit' value='Send' action='' ></td>
</tr>
</table></td>", $myrow['id'],$myrow['name'],$myrow['lname'],$myrow['mail']);
}
while ($myrow = mysql_fetch_array ($result));
?>
</tr>
</table>
</body>
</html>