I am trying to create a link with php, but am having some difficulty. Can someone help me with this. I want the link to go to yourteam.php with the title being whatever the variable $row['User_ID'] is....
echo "<tr bgcolor=\"#D1D1D1\"><td>" . "<a href=\"yourteam.php\">$row['User_ID']</a>" . "</td><td><b>" . $row['Correct_Picks'] . " </b> /" . $maxcorrectpicks . "</td><td>" . $row['Points'] . "</td></tr>";
When using a array item in a double quoted string you leave out any quotes
echo "<tr bgcolor=\"#D1D1D1\"><td>" . "<a href=\"yourteam.php\">$row[User_ID]</a>" .
you can also wrap the variable in {}
echo "<tr bgcolor=\"#D1D1D1\"><td>" . "<a href=\"yourteam.php\">{$row['User_ID']}</a>" .
Try this
echo "<tr bgcolor='#D1D1D1'><td><a href='yourteam.php'>".$row['User_ID']."</a></td><td><b>" . $row['Correct_Picks'] . "</b>" . $maxcorrectpicks . "</td><td>" . $row['Points'] . "</td></tr>";
I suggest you to use <strong></strong>
instead of <b></b>
and also you can use inline style as style='background-color:#D1D1D1;'
instead of bgcolor
.
I know people suggested using single quotes, but I like to use double quotes on my HTML attributes and use indentation within my echo statements for readibility. Here's how I would do it...
echo "<tr bgcolor=\"#D1D1D1\">";
echo " <td><a href=\"yourteam.php\">{$row['User_ID']}</a></td>";
echo " <td><b>{$row['Correct_Picks']}</b>{$maxcorrectpicks}</td>";
echo " <td>{$row['Points']}</td>";
echo "</tr>";