Page 1 of 1

Email Link

Posted: Tue Jun 11, 2002 1:33 pm
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?

Posted: Tue Jun 11, 2002 1:35 pm
by volka
<a href=\"mailto:'.$row['email_address'] .'\">'.$row['email_address'] .'</a>
can you provide a little more context, please?

Posted: Tue Jun 11, 2002 1:37 pm
by MattF
if you are using echo 'stuff'; then PHP just dumps it on the page without parsing it.

Posted: Tue Jun 11, 2002 1:39 pm
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>";

Posted: Tue Jun 11, 2002 1:39 pm
by Piera
It works now the problem was with the quoting! :)

Posted: Tue Jun 11, 2002 6:56 pm
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.

Posted: Wed Jun 12, 2002 1:41 am
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

Posted: Thu Jun 13, 2002 5:38 am
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>";

Posted: Thu Jun 13, 2002 7:15 am
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