Jump to content

Recommended Posts

I have a search results page the returns information based on a simple search.

<html>

<style type="text/css">
<!--
a:link {
color: #0000FF;
text-decoration: none;
}
a:visited {
text-decoration: none;
color: #FF0000;
}
a:hover {
text-decoration: none;
color: #FF0000;
}
a:active {
text-decoration: none;
color: #FF0000;
}
-->
</style>

<body>
<? 
if ($search) // perform search only if a string was entered. 
{ 
mysql_connect('localhost','xxxxxx,'xxxxxx') or die ("Problem connecting to DataBase"); 
$srch="%".$search."%"; 
$query = "select * from visitors WHERE Name LIKE '$srch' || Last LIKE '$srch' || email LIKE '$srch' || comment LIKE '$srch'"; 

$result = mysql_db_query("xxxxxx", $query); 

if ($result) 
{ 
echo "Here are the results:<br><br>"; 
echo "<table width=90% align=center border=1><tr> 
<td align=center bgcolor=#00FFFF>Visit time and date</td> 
<td align=center bgcolor=#00FFFF>User Name</td> 
<td align=center bgcolor=#00FFFF>Last Name</td> 
<td align=center bgcolor=#00FFFF>Email</td> 
</tr>"; 

while ($r = mysql_fetch_array($result)) { // Begin while 
$ts = $r["TimeStamp"]; 
$name = $r["Name"]; 
$last = $r["Last"]; 
$email = $r["email"]; 
$comment = $r["comment"]; 
echo "<tr> 
<td>$ts</td> 
<td><a href= $name>$name</td> 
<td>$last</td> 
<td><a href= mailto:$email>$email</td></tr> 
<tr> <td colspan=4 bgcolor=\"#ffffa0\">$comment</td> 
</tr>"; 
} // end while 
echo "</table>"; 
} else { echo "problems...."; } 
} else { 
echo "Search string is empty. <br> Go back and type a string to search"; 
} 
include ('links.x'); 
?> 
</body>
</html>

 

What I would like to do is to make the "name" become a hyperlink that you can click on and will take you to another page that shows the complete individual record laid out in a table.  There are approximatly 17 additional colums of information that will need to be displayed on the next

Link to comment
https://forums.phpfreaks.com/topic/80045-extended-search-results/
Share on other sites

just add a link on to that name

 

eg..

<a href="location.php?id=putheretheid">thename</a>

now on the second page where this link will navigate you will have to get the GET var whic is id

 

and then query it on the next page having the condition using your id's ....

You say "location.php".  What is that?  Also what do you mean put here the id?  I am assuming this makes the mane appear and turns it into a hyperlink based on the ID.

 

What does the code ofr the next page look like.  Only new so learnign all this myself.

 

Thanks

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.