I have a page which I list people from a directory using a search which gives a result like:
Name Address Phone Details
Name1 address1 phone1 detail_link
name2 address2 phone2 detail_link
etc
Of course each of these records has an ID but also a lot of additional information. I want the "detail_link" to use the ID of the selected link (record) to retrieve that information. Not sure how the code should go to do that.
link to more info from queried list
Moderator: General Moderators
So you make a detail.php page that accepts the id...
Offcourse your list would generate html like
Code: Select all
<?php
if (issset($_GET['id']))
{
// lookup record with that id
}
else
{
// users needs to select a record first, display list
header('Location: http://mysite.example.com/list.php');
}
?>Code: Select all
<a href="e;detail.php?id=xxxx"e;>item xxxx</a>
<a href="e;detail.php?id=yyyy"e;>item yyyy</a>Hi,
Do you mean show basic details on one page, then link to full details on another?
Try:
index.php
full_details.php
Thats just a basic concept to give you the idea.
I like to break out of the php tags and use
so I can visually see the html tables etc etc, makes for easyer editing.
HTH
Do you mean show basic details on one page, then link to full details on another?
Try:
index.php
Code: Select all
<?php
// connection details
$sql = "SELECT * FROM table ";
$result = mysql_query($sql);
while ($row = mysql_fetch_array($result)) {
$id = $row['id'];
$name = $row['name'];
$bla = $row['bla'];
echo "$name - $bla <a href=\"../full_details.php?id=$id\">(view full details)</a>";
}
?>Code: Select all
<?php
// connection details
$id = $_GET['id'];
$sql = "SELECT * FROM table WHERE id = '$id'";
$result = mysql_query($sql);
while ($row = mysql_fetch_array($result)) {
$id = $row['id'];
// call on other table rows you want to display
echo "$name - $bla etc etc";
}
?>I like to break out of the php tags and use
Code: Select all
<td><div align="left"><?php echo $row['name']; ?></div></td>HTH