Page 1 of 1
PHP Mailto Problem
Posted: Wed Feb 20, 2008 10:09 am
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
Re: PHP Mailto Problem
Posted: Wed Feb 20, 2008 10:36 am
by liljester
Code: Select all
print"<A HREF=\"mailto:{$nt['EMAIL']}\">Sample Email Address</A>";
Re: PHP Mailto Problem
Posted: Wed Feb 20, 2008 10:39 am
by liljester
you can use {braces} around variables and array names in strings so that if you use $array['something'] it parses correctly.
Re: PHP Mailto Problem
Posted: Wed Feb 20, 2008 10:49 am
by apoch632
Thanks man.
Worked a treat
Re: PHP Mailto Problem
Posted: Wed Feb 20, 2008 10:52 am
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
Re: PHP Mailto Problem
Posted: Wed Feb 20, 2008 11:26 am
by liljester
Code: Select all
echo '<A HREF="mailto:'.$nt['EMAIL'].'>Sample Email Address</A>';
Re: PHP Mailto Problem
Posted: Wed Feb 20, 2008 1:00 pm
by kryles
oops, thats what i get for copy paste....but yeah closing string quotes would have been good lol