consider i have two forms:
1: this form will display(listing) all the names from the database table and beside to each name displayed i have view button
2: this will show the details of only selected names from the 1st page.

tables will contain name_Id, name, age, address.

give me how to implement so that it has to display only the selected person from the database, give me the sql structure if possible whole code purely php. please give me the full codes
thank you

10 Years
Discussion Span
Last Post by vijukumar

try this

1st page

print "<a href='2ndpage.php?id=".$row[0]."'>"view</a>";

2nd page
$hostname = "localhost";
$username = "";
$password = "";
$dbid = "dbname";
$link=mysql_connect($hostname, $username, $password);
mysql_select_db($dbid) or die("unable to connect");
$result=mysql_query("SELECT id,age,name FROM tablename where id='$line'");
for ($i = 0; $i < 1; ++$i)
$line = mysql_fetch_row($result);
print "<table bgcolor='#EBEBEB' width='73%' align='center'>";
print "<tr><td>ID </td>$line[0]</td></tr>";
print "<tr><td width='5%'></td><td></td></tr>";
print "</table>";


instead lydia21 solution, you can add "hidden field" in your first form containing field "ID"
like :
<input name="id" type="hidden" id="id" value="<? echo $row[id] ?>" />

in your second page u can acces this hidden field value to make your details query.

hope it help

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.