ash_dev15 ash_dev15 - 6 months ago 9
SQL Question

Link is redirecting in local host instead of actual website

I have a table with different column. on of them is website, which should redirect me to a website when clicked upon. however it is looking the website up in my local host.


http://127.0.0.1:8090/test/http://www.amity.edu/mauritius/


it should be


http://www.amity.edu/mauritius/


here is the code for the table:

<?php


include ('db_connect.php');

$sql="select * from institution";



$result= mysqli_query($conn, $sql);


while ($row = mysqli_fetch_array($result)){

echo "<tr>";
echo "<td>" . $row['ins_id'] . "</td>";
echo "<td>" . $row['ins_name'] . "</td>";
echo "<td>" . $row['address'] . "</td>";
echo "<td>" . $row['contact'] . "</td>";
echo "<td><a href=" . $row['website'] . ">" . $row['website'] . "</a></td>";
echo "<td>" . $row['email'] . "</td>";

echo "</tr>";
}
echo "</table>"
?>


What should i do to make it go to the website?
Thank you in advance.

Answer

You need to prepend your URL with http:// or https://

echo "<td><a href='http://" . $row['website'] . "'>" . $row['website'] . "</a></td>";