I tried to add hyperlink to php but it's not working. Is there any mistakes ? `
echo "<td nowrap ".$rowspan.">\n";
echo "<font face=\"arial\" size=\"1\" color=\"#3C5F84\">\n";
echo "  " .$v["refno"].$v["barvalue"]. "     ";
echo "</font>\n";
echo "<a href=\"www.google.com\"></a>\n";
echo "</td>\n";
`
I tried to add the hyperlink to the current php code but it's not working either when I click.
CodePudding user response:
- You are missing text inside the hyperlink display
- You need to add http:// in order to visit an external link
So change the line
echo "<a href=\"www.google.com\"></a>\n";
to
echo "<a href=\"http://www.google.com\">google</a>\n";
So the code will be:
<?php
echo "<table><tr><td nowrap ".$rowspan.">\n";
echo "<font face=\"arial\" size=\"1\" color=\"#3C5F84\">\n";
echo "  " .$v["refno"].$v["barvalue"]. "     ";
echo "</font>\n";
echo "<tr><td><a href=\"http://www.google.com\">google</a>\n";
echo "</td></table>\n";
?>
You may check the following Sandbox
showing the result (values of $v["refno"] and $v["barvalue"] omitted):
http://www.createchhk.com/SOanswers/testSO9Nov2022b.php
CodePudding user response:
try this:
"<a href=//www.google.com></a>\n";