PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
apoch632
Forum Newbie
Posts: 2 Joined: Wed Feb 20, 2008 9:56 am
Post
by apoch632 » Wed Feb 20, 2008 10:09 am
Basically I want my PHP code to display the email address I have stored for a user in a MySQL database but I also want it to be enabled as a mailto link
Code: Select all
echo '<A HREF="mailto:'$nt['EMAIL']'>Sample Email Address</A>';
$nt['EMAIL'] is the email variable.
Can anyone show me where I'm going wrong cheers
liljester
Forum Contributor
Posts: 400 Joined: Tue May 20, 2003 4:49 pm
Post
by liljester » Wed Feb 20, 2008 10:36 am
Code: Select all
print"<A HREF=\"mailto:{$nt['EMAIL']}\">Sample Email Address</A>";
liljester
Forum Contributor
Posts: 400 Joined: Tue May 20, 2003 4:49 pm
Post
by liljester » Wed Feb 20, 2008 10:39 am
you can use {braces} around variables and array names in strings so that if you use $array['something'] it parses correctly.
apoch632
Forum Newbie
Posts: 2 Joined: Wed Feb 20, 2008 9:56 am
Post
by apoch632 » Wed Feb 20, 2008 10:49 am
Thanks man.
Worked a treat
kryles
Forum Contributor
Posts: 114 Joined: Fri Feb 01, 2008 7:52 am
Post
by kryles » Wed Feb 20, 2008 10:52 am
Code: Select all
echo '<A HREF="mailto:'[b].[/b]$nt['EMAIL'][b].[/b]'>Sample Email Address</A>
I think that is an alternative that would work
liljester
Forum Contributor
Posts: 400 Joined: Tue May 20, 2003 4:49 pm
Post
by liljester » Wed Feb 20, 2008 11:26 am
Code: Select all
echo '<A HREF="mailto:'.$nt['EMAIL'].'>Sample Email Address</A>';
kryles
Forum Contributor
Posts: 114 Joined: Fri Feb 01, 2008 7:52 am
Post
by kryles » Wed Feb 20, 2008 1:00 pm
oops, thats what i get for copy paste....but yeah closing string quotes would have been good lol