Hi folks,
This is my first post, so I would like to say hello to everyone.
I am a complete 'newbie' and need help to add a <a href> link to my mysql / php list. When a user clicks the link, it will take the user to "contactform.php" taking the [id] with it to enter further details on the form.
The details are (<a href bit in RED):
Connect......
$conn = mysql_connect("$location","$username","$password");
if (!$conn) die ("Could not connect MySQL");
mysql_select_db($database,$conn) or die ("Could not open database");
$query = "SELECT * FROM wanted ORDER BY catergory";
$result = mysql_query($query) or die ("Query failed");
$numofrows = mysql_num_rows($result);
echo "<TABLE BORDER=\"1\">\n";
echo "<TR bgcolor=\"lightblue\"><TD>id</TD><TD>surname</TD><TD>dates</TD><TD>country</TD><TD>county</TD><TD>details</TD><TD>Contact</TD></TR>\n";
for($i = 0; $i < $numofrows; $i++) {
$row = mysql_fetch_array($result);
if($i % 2) {
echo "<TR bgcolor=\"yellow\">\n";
} else {
echo "<TR bgcolor=\"white\">\n";
}
echo "<TD>".$row['id']."</TD><TD>".$row['surname']."</TD><TD>".$row['dates']."</TD><TD>".$row['country']."</TD><TD>".$row['county']."</TD><TD>".$row['details']."</TD><TD>".$row" <a href="contactform.php?id=$row['id']"."</TD>\n";
echo "</TR>\n";
}
echo "</TABLE>\n";
?>
Can someone tell me I have gone wrong?
Regards,
Dave