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

Recommended Answers

All 3 Replies

try this

1st page
<?

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

2nd page
<?php
$hostname = "localhost";
$username = "";
$password = "";
$dbid = "dbname";
$link=mysql_connect($hostname, $username, $password);
mysql_select_db($dbid) or die("unable to connect");
$line=$_GET;
$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

lydia21
rudevils

thanks a ton guys it helped me a lot.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.