Reputation: 33
I've been trying to get my Email and URL to show up as hyperlinks with a href and mailto with no luck. Can someone take a look at the following code and let me know what I need to do? Thanks.
<?php
mysql_connect ("localhost", "root", "") or die (mysql_error());
mysql_select_db ("store_location");
$term = $_POST['term'];
$sql = mysql_query("SELECT *
FROM store_location
WHERE store_name like '%$term%'
OR address like '%$term%'
OR city like '%$term%'
OR state like '%$term%'
OR zip like '%$term%'
OR phone like '%$term%'
OR fax like '%$term%'
OR email like '%$term%'
OR url like '%$term%' ");
while ($row = mysql_fetch_array($sql)){
echo '<h1>Search Results:</h1>';
echo 'Store Name: '.$row['store_name'];
echo '<br/> Address: '.$row['address'];
echo '<br/> City: '.$row['city'];
echo '<br/> State: '.$row['state'];
echo '<br/> Zip: '.$row['zip'];
echo '<br/> Phone: '.$row['phone'];
echo '<br/> Fax: '.$row['fax'];
echo '<br/> Email: '.$row['email'];
echo '<br/> URL: '.$row['url'];
echo '<br/><br/>';
}
?>
Upvotes: 0
Views: 800
Reputation: 2757
This should help you
echo "<br/><a href='mailto:".$row['email']."'>".$row['email']."</a>"
Upvotes: 0
Reputation: 11250
As your Output is HTML simply write
echo '<br/> Email: <a href="mailto:'.$row['email'].'">'.$row['email'].'</a>';
Upvotes: 3