email to link

C

Chas

I am using this code

<table border="1">
<%
Do While Not rstSimple.EOF
%>
<tr>
<td><%= rstSimple.Fields("username").Value %></td>
<td><%= rstSimple.Fields("password").Value %></td>
<td><%= rstSimple.Fields("email").Value %></td>
</tr>
<%
rstSimple.MoveNext
Loop
%>
</table>

How can I make the email field a hyper link?

Charlie
 
R

Ray at

How would you do it if you hard"coded" the HTML?

<td><a href="mailto:p[email protected]">[email protected]</a></td>

Right? So, substitute the e-mail address for the variable (or recordset
value) that represents the e-mail address. Let's put the value into a
variable to make it simpler and a bit more efficient though.


<%
sEmail = rstSimple.Fields("email").Value
%>

<table border="1">
<%
Do While Not rstSimple.EOF
%>
<tr>
<td><%= rstSimple.Fields("username").Value %></td>
<td><%= rstSimple.Fields("password").Value %></td>
<td><a href="mailto:<%=sEmail%>"><%=sEmail%></a></td>
</tr>
<%
rstSimple.MoveNext
Loop
%>
</table>


Ray at home
 
C

Chas

Thanks so much this is great!
Charlie

Ray at said:
How would you do it if you hard"coded" the HTML?

<td><a href="mailto:p[email protected]">[email protected]</a></td>

Right? So, substitute the e-mail address for the variable (or recordset
value) that represents the e-mail address. Let's put the value into a
variable to make it simpler and a bit more efficient though.

<%
sEmail = rstSimple.Fields("email").Value
%>

<table border="1">
<%
Do While Not rstSimple.EOF
%>
<tr>
<td><%= rstSimple.Fields("username").Value %></td>
<td><%= rstSimple.Fields("password").Value %></td>
<td><a href="mailto:<%=sEmail%>"><%=sEmail%></a></td>
</tr>
<%
rstSimple.MoveNext
Loop
%>
</table>

Ray at home
 
A

Aaron Bertrand [MVP]

<%
sEmail = rstSimple.Fields("email").Value
%>

<table border="1">
<%
Do While Not rstSimple.EOF
%>

Well, you probably want to assign the value inside the loop. ;-)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top