PHP Mailto Problem

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

Post Reply
apoch632
Forum Newbie
Posts: 2
Joined: Wed Feb 20, 2008 9:56 am

PHP Mailto Problem

Post by apoch632 »

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
User avatar
liljester
Forum Contributor
Posts: 400
Joined: Tue May 20, 2003 4:49 pm

Re: PHP Mailto Problem

Post by liljester »

Code: Select all

print"<A HREF=\"mailto:{$nt['EMAIL']}\">Sample Email Address</A>";
User avatar
liljester
Forum Contributor
Posts: 400
Joined: Tue May 20, 2003 4:49 pm

Re: PHP Mailto Problem

Post by liljester »

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

Re: PHP Mailto Problem

Post by apoch632 »

Thanks man.
Worked a treat
kryles
Forum Contributor
Posts: 114
Joined: Fri Feb 01, 2008 7:52 am

Re: PHP Mailto Problem

Post by kryles »

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
User avatar
liljester
Forum Contributor
Posts: 400
Joined: Tue May 20, 2003 4:49 pm

Re: PHP Mailto Problem

Post by liljester »

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

Re: PHP Mailto Problem

Post by kryles »

oops, thats what i get for copy paste....but yeah closing string quotes would have been good lol
Post Reply