Email Link

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
Piera
Jason's GF
Posts: 10
Joined: Fri Apr 19, 2002 9:30 am
Location: Montreal
Contact:

Email Link

Post by Piera »

I am trying to make a valid email link but i am not having much luck!
This is what I wrote

Code: Select all

<a href="mailto:'.$row&#1111;'email_address'] .'">'.$row&#1111;'email_address'] .'</a>
When I put my mouse over the link it gives me a complete web URL with
this as part of it "mailto:'.$row['email_address'] .'\"

Is there anywhere I am going wrong?
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

<a href=\"mailto:'.$row['email_address'] .'\">'.$row['email_address'] .'</a>
can you provide a little more context, please?
MattF
Forum Contributor
Posts: 225
Joined: Sun May 19, 2002 9:58 am
Location: Sussex, UK

Post by MattF »

if you are using echo 'stuff'; then PHP just dumps it on the page without parsing it.
Wandrer
Forum Newbie
Posts: 21
Joined: Thu Jun 06, 2002 8:43 am

Post by Wandrer »

<a href=\"mailto:'.$row['email_address'] .'\">'.$row['email_address'] .'</a>
How about this:

"<a href=\"mailto:" . $row['email_address'] ."\">" . $row['email_address'] ."</a>";
Piera
Jason's GF
Posts: 10
Joined: Fri Apr 19, 2002 9:30 am
Location: Montreal
Contact:

Post by Piera »

It works now the problem was with the quoting! :)
User avatar
gotDNS
Forum Contributor
Posts: 217
Joined: Tue May 07, 2002 5:53 pm
Location: West Chester, PA

Post by gotDNS »

I use web mail without a program, I dont think your system is effective. :D

Try making a nice PHP script with the mail function and have them fill out the from right on the website. Give people the option to do that, at least.
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

If you want to avoid having to escape the double quotes in the HTML you could have,

Code: Select all

echo '<a href="mailto:'.$row&#1111;'email_address'].'">'.$row&#1111;'email_address'].'</a>';
Mac
User avatar
mikeq
Forum Regular
Posts: 512
Joined: Fri May 03, 2002 3:33 am
Location: Edinburgh, Scotland

Post by mikeq »

On the other hand, if you don't want to concatenate then...


echo "<a href=\"mailto:$row['email_address']\">$row['email_address']</a>";
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

mikeq wrote:On the other hand, if you don't want to concatenate then...


echo "<a href="mailto:$row['email_address']">$row['email_address']</a>";
Down to personal preference at the end of the day. I like being able to cut and paste HTML from and to non-php pages. I code using a syntax highlighter so concanation means I can see where variables are, making debugging a bit easier. I have large loops and stuff where having PHP ignoring things in single quotes makes it a bit more streamlined.

Each to their own really.

Mac
Post Reply