Let's break it down, I'm doing a site where I'm going to read a URL from the database and then I'm going to use it in an image, clicking on it (image) will open that URL (inside an iframe or in a new tab).
In the code, I have a page using HTML and PHP where I show the image with the hyperlink URL visible :
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<div>
<?php
include ("connection.php");
$sql = "SELECT * FROM table";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
echo "<div class=\"gallery\">";
echo " <a target=\"iframe1\" href=\"".$row["url"]."\" onclick=\"openiframe()\">";
echo " <img src=\"images\".$row["image"]."\" width=\"600\" height=\"400\">";
echo " </a>";
echo " <div class=\"desc\"><a href=\"".$row["url"]."\" target=\"_blank\">".$row["name"]."</a></div>";
echo "</div>";
}
} else {
echo "0 results";
}
$conn->close();
?>
</div>
</body>
</html>
The result of the previous code looks something like this:
Sofarsogood,nowwhatIintendedwasnottobevisibletheURL,inthefollowingimageImarkedwhatIsay:
Is there a way to hide the URL using eg PHP or some other way?