This topic is locked
[SOLVED]

 email link on concat

4/9/2010 2:05:02 PM
PHPRunner General questions
M
mdorren author

Hi,

Probably a simple question, but I can't seem to find the answer in my searches. Here goes:
I have used concat(firstname+lastname) to display the agents name in a list page. What I would like to do now, is have the name be a link that would create a "mailto:" command with various record info (including the email address of the agent). I can get the info for the agent into the sql query as separate columns, but how do I integrate the data into the link?
Thanks

A
alang 4/11/2010

Use "Custom" field type in the visual editor and construct the link appropriately using $data["your_other_fields"] as appropriate. ie $value="<a href=...>Link Text</a>";

M
mdorren author 4/12/2010

Thanks for the reply. I have a conceptual understanding of what you just wrote (thus the concat) however, I'm a bit "iffy" regarding the syntax for separating html code from $data[] markers (especially regarding double quotes) For instance, in the case of:
<a href="mailto:mdorren@lognet.com">Martin Dorren</a>, Obviously my mdorren@lognet.com would be my $data["aemail"] column from my sql query, and the martin dorren might be my $data["afullname"] column from my sql query.
That being said, am I correct in assuming that:
$value = "<a href="mailto:$data["aemail"]">$data["afullname"]</a>";
is the correct syntax? The double quotes don't seem to match up.
Once again, thanks for your help.
Marty

Sergey Kornilov admin 4/13/2010

Try this:

$value = "<a href="mailto:" . $data["aemail"] . ">" . $data["afullname"] . "</a>";


Dot is a concatenation operator in PHP.

M
mdorren author 4/13/2010



Try this:

$value = "<a href="mailto:" . $data["aemail"] . ">" . $data["afullname"] . "</a>";


Dot is a concatenation operator in PHP.


when using:

$value = "<a href="mailto:" . $data["aemail"] . ">" . $data["afirstname"]." ".$data["alastname"] . "</a>";
I got a "syntax error, unexpected T_STRING in line 1
Any thoughts?

Sergey Kornilov admin 4/13/2010

Update:

$value = "<a href='mailto:" . $data["aemail"] . "'>" . $data["afirstname"]." ".$data["alastname"] . "</a>";
M
mdorren author 4/13/2010



Update:

$value = "<a href='mailto:" . $data["aemail"] . "'>" . $data["afirstname"]." ".$data["alastname"] . "</a>";




That did it! Many Thanks!