matt.sisto Posted March 30, 2009 Share Posted March 30, 2009 I am pulling an email address from my table in the db, however I would like the user to be able to click on it and activate a mail link I am trying to do it like this: <td><a href"mailto:<?=$row['email_address']?>"><?=$row['email_address']?></a></td> Appreciate any help. Link to comment https://forums.phpfreaks.com/topic/151797-solved-email-link-from-table/ Share on other sites More sharing options...
Brian W Posted March 30, 2009 Share Posted March 30, 2009 whats wrong with that? That seems to me to be correct if you are fetching an associative array from your query result. Link to comment https://forums.phpfreaks.com/topic/151797-solved-email-link-from-table/#findComment-797041 Share on other sites More sharing options...
matt.sisto Posted March 30, 2009 Author Share Posted March 30, 2009 It doesn't work though. ??? Link to comment https://forums.phpfreaks.com/topic/151797-solved-email-link-from-table/#findComment-797043 Share on other sites More sharing options...
matt.sisto Posted March 30, 2009 Author Share Posted March 30, 2009 Does anybody know why this isn't working? <td><a href"mailto:<?=$row['email_address']?>"><?=$row['email_address']?></a></td> Link to comment https://forums.phpfreaks.com/topic/151797-solved-email-link-from-table/#findComment-797075 Share on other sites More sharing options...
Brian W Posted March 30, 2009 Share Posted March 30, 2009 please post the code for the entire page... Link to comment https://forums.phpfreaks.com/topic/151797-solved-email-link-from-table/#findComment-797078 Share on other sites More sharing options...
matt.sisto Posted March 30, 2009 Author Share Posted March 30, 2009 <?php session_start(); if (!isset($_SESSION['username'])) { header("Location: loginform1.php"); exit(); } require "dbconn2.php"; $sql = "SELECT * FROM interest"; $result = mysql_query ($sql, $connection) or die ("Couldn't perform query $sql <br />".mysql_error()); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Interest in Services</title> <link href="master.css" rel="stylesheet" type="text/css"> </head> <body> <div id="topbanner"> <h1>Rate List</h1></div> <div id="border"></div> <div id="mid"> <table id="table" cellpadding="1px" cellspacing="1px" bordercolordark="#333"> <tr> <th bgcolor="#CCCCCC" align="left">ID </th> <th bgcolor="#CCCCCC" align="left">Name</th> <th bgcolor="#CCCCCC" align="left">Email Address</th> <th bgcolor="#CCCCCC" align="left">Service</th> <th bgcolor="#CCCCCC" align="left">Summary</th> <th bgcolor="#CCCCCC" align="left">Remove</th> </tr> <?php while ($row = mysql_fetch_array($result)) {?> <tr> <td><?=$row['int_id']?></td> <td><?=$row['name']?></td> <td><a href="mailto:<?=$row['email_address']?>"><?=$row['email_address']?></a></td> <td><?=$row['service']?></td> <td><?=$row['summary']?></td> <td align="center"><a href="deleteinterest.php?rate_id=<?=$row['int_id']?>">[-]</a></td> </tr> <?php } ?> </table> </div> <div id="left"> <br /> <input id="button1" type="submit" onClick="javascript:self.close()" value="close"> <input id="button2" type="submit" value="Back" onClick="history.go(-1)"> </div> </body> </html> Link to comment https://forums.phpfreaks.com/topic/151797-solved-email-link-from-table/#findComment-797085 Share on other sites More sharing options...
Brian W Posted March 30, 2009 Share Posted March 30, 2009 What output do you get when you run that? Does it seem to be looping as many times as you expected? What is output in the loop? Link to comment https://forums.phpfreaks.com/topic/151797-solved-email-link-from-table/#findComment-797105 Share on other sites More sharing options...
matt.sisto Posted March 30, 2009 Author Share Posted March 30, 2009 The output is fine its just the mail to link. Link to comment https://forums.phpfreaks.com/topic/151797-solved-email-link-from-table/#findComment-797120 Share on other sites More sharing options...
Brian W Posted March 30, 2009 Share Posted March 30, 2009 what does the mailto link look like when it is output? Sorry if the question sounds stupid Link to comment https://forums.phpfreaks.com/topic/151797-solved-email-link-from-table/#findComment-797124 Share on other sites More sharing options...
matt.sisto Posted March 30, 2009 Author Share Posted March 30, 2009 It displays the email address, but when you click on it it goes nowhere. ??? Link to comment https://forums.phpfreaks.com/topic/151797-solved-email-link-from-table/#findComment-797135 Share on other sites More sharing options...
Brian W Posted March 30, 2009 Share Posted March 30, 2009 copy and past the html output please, you can modify the email address for privacy if that is an issue... but keep the link intact. What do you expect to happen when you click on the link? 90% of users out there are going to have Microsoft Outlook popup when they click a mailto link Link to comment https://forums.phpfreaks.com/topic/151797-solved-email-link-from-table/#findComment-797137 Share on other sites More sharing options...
lonewolf217 Posted March 30, 2009 Share Posted March 30, 2009 do you have some sort of mail client installed on the machine you are using ? namely Outlook or some equivolent would be required to get that to work i think. Link to comment https://forums.phpfreaks.com/topic/151797-solved-email-link-from-table/#findComment-797138 Share on other sites More sharing options...
matt.sisto Posted March 30, 2009 Author Share Posted March 30, 2009 Yes I do, and you would think it would start up when the link is activated but it doesn't. ??? Link to comment https://forums.phpfreaks.com/topic/151797-solved-email-link-from-table/#findComment-797144 Share on other sites More sharing options...
lonewolf217 Posted March 30, 2009 Share Posted March 30, 2009 copy and paste the page source (open page in IE or firefox, right click and view source to see whats generated) then paste it here so we can see it Link to comment https://forums.phpfreaks.com/topic/151797-solved-email-link-from-table/#findComment-797147 Share on other sites More sharing options...
matt.sisto Posted March 30, 2009 Author Share Posted March 30, 2009 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Interest in Services</title> </head> <body> <div id="topbanner"> <h1>Rate List</h1></div> <div id="border"></div> <div id="mid"> <table id="table" cellpadding="1px" cellspacing="1px" bordercolordark="#333"> <tr> <th bgcolor="#CCCCCC" align="left">ID </th> <th bgcolor="#CCCCCC" align="left">Name</th> <th bgcolor="#CCCCCC" align="left">Email Address</th> <th bgcolor="#CCCCCC" align="left">Service</th> <th bgcolor="#CCCCCC" align="left">Summary</th> <th bgcolor="#CCCCCC" align="left">Remove</th> </tr> <tr> <td>4</td> <td>MR M SISTO</td> <td><a href"mailto:[email protected]">[email protected]</a></td> <td>consultancy</td> <td>mattge</td> <td align="center"><a href="deleteinterest.php?interest_id=4">[-]</a></td> </tr> </table> </div> <div id="left"> <br /> <input id="button1" type="submit" onClick="javascript:self.close()" value="close"> <input id="button2" type="submit" value="Back" onClick="history.go(-1)"> </div> </body> </html> Link to comment https://forums.phpfreaks.com/topic/151797-solved-email-link-from-table/#findComment-797152 Share on other sites More sharing options...
lonewolf217 Posted March 30, 2009 Share Posted March 30, 2009 missing an = sign <td><a href="mailto:[email protected]">[email protected]</a></td> Link to comment https://forums.phpfreaks.com/topic/151797-solved-email-link-from-table/#findComment-797156 Share on other sites More sharing options...
matt.sisto Posted March 30, 2009 Author Share Posted March 30, 2009 Thanks mate, I feel like a bit of a twat now, but at least its fixed. Link to comment https://forums.phpfreaks.com/topic/151797-solved-email-link-from-table/#findComment-797160 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.