Jump to content

Recommended Posts

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. 8)

Link to comment
https://forums.phpfreaks.com/topic/151797-solved-email-link-from-table/
Share on other sites

<?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>

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

<!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:matt.sisto@gmail.com">matt.sisto@gmail.com</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>

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.