PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
<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 search page.
$name = $_GET['name']; // pulls the name=_____ from the URL
$result = mysql_query("SELECT *FROM visitors WHERE Name='$name'") or die(mysql_error());
$row = mysql_fetch_array($result);
// then echo your results here