Page 1 of 1
Clicking person name to load Email
Posted: Mon Dec 20, 2004 4:27 pm
by mohson
Guys, below I have a list of fields which are displayed on my web site I want to store the email field inside the firstname field to allow the user to click the persons name to load a email program with the person email address automatically loaded in the send to box. I have done this in another version of this code but as I have changed it I dont know how to do it here - can anyone help??? Where do I put the code and what do I write???
Code: Select all
"<table>";while ($row = mysql_fetch_object($sql))
{($color==$color2)? $color = $color1 : $color = $color2;
echo "<tr bgcolor="$color"><td>".$count . '</td><td> ' . $row->person_id .'</td><td>'.
$row->salutation .'</td><td>'.
$row->firstname .'</td><td>'.
$row->surname .'</td><td>'.
$row->organisation .'</td><td>'.
$row->role.'</td><td>'.
$row->address1 .'</td><td>'.
$row->address2 .'</td><td>'.
$row->city .'</td><td>'.
$row->postcode .'</td><td>'.
$row->telephone .'</td><td>'.
$row->mobile .'</td><td>'.
$row->fax .'</td><td>'.
$row->dateoflastcontact.'</td><td>'.
$row->datecontactagain .'</td><td>'.
$row->email .'</td><td>'.
$row->notes .'</td></tr>';
$count += 1;
}
echo "</table>";
Posted: Mon Dec 20, 2004 4:35 pm
by timvw
the most braindead solution would be: echo a <a href with the thingies in...
<a href="mailto:
john@example.com?subject=some subject&body=something in da body">
john@example.com</a>
Posted: Tue Dec 21, 2004 4:52 am
by mohson
that sounds good but I want it to highlight every persons name where about would I put that in the code before <td> or after the $firstname variable. - FROM what I know I need to store the variable $email inside the variable $firstname -
I did it like this before;
<a href=\"mailto: $email\">$firstname
can it not be done like this again??
Posted: Tue Dec 21, 2004 5:26 am
by seeker2921
<a href=\"mailto: $email\">$firstname</a>
simple html bro..
Posted: Tue Dec 21, 2004 6:02 am
by mohson
thanks man - Ive kinda worked that much out - the problem is that when I add this to my code the screen goes blank - how do I add it to this line:
???
When I add it like this:
Code: Select all
$row-><a href="mailto: $email">$firstname</a>.'</td><td>'.
I get problems
Posted: Tue Dec 21, 2004 6:13 am
by magicrobotmonkey
Code: Select all
<?php
'<a href=mailto:'.$row->email.'>'.$row->firstname .'</a></td><td>'.
?>
Posted: Tue Dec 21, 2004 6:33 am
by mohson
thanks alot thats sorted - Last question though I have another coloum which is called organisation I want to do the same with this but the date for this coloum comes from another table.
Basically I wnat to store $web_url inside organisation but I dont think it will work as web_url comes from another table which is not specified in this query - any ideas how I would go about this???
Code: Select all
echo "<tr bgcolor="$color"><td>".$count . '</td><td> ' . $row->person_id .'</td><td>'.
$row->salutation .'</td><td>'.
'<a href=mailto:'.$row->email.'>'.$row->firstname .'</a></td><td>'.
'<a href=mailto:'.$row->email.'>'.$row->surname .'</a></td><td>'.
$row->organisation .'</td><td>'.
$row->role.'</td><td>'.
$row->address1 .'</td><td>'.
$row->address2 .'</td><td>'.
$row->city .'</td><td>'.
$row->postcode .'</td><td>'.
$row->telephone .'</td><td>'.
$row->mobile .'</td><td>'.
$row->fax .'</td><td>'.
$row->dateoflastcontact.'</td><td>'.
$row->datecontactagain .'</td><td>'.
$row->email .'</td><td>'.
$row->notes .'</td></tr>';
$count += 1;
}
echo "</table>";
Posted: Tue Dec 21, 2004 6:45 am
by genetix
So your saying your script already disconnected from the other database but you need variables from both?
You could just start two mysql_queries or what I do is assign the value to a variable.
Hope that helps.
Posted: Tue Dec 21, 2004 10:22 am
by mohson
thanks for getting back to me - the problem is i want the coloum that llists organisations to be displayed as a link so that it goes to the companies website when you click it - I thught I could do this the same way as when you click a persons name and you go to your default mail service - i.e stroing the field variabl $email inside $firstname.
You cant do this though as the field that contains web_url is stored in the organisations table - my query only selects fields from the people table.
So how would I go about linking the web_url field into the organisations field when web_url is in the organisations table.
$web_url is stored in the organisations table.
Any Ideas anyone???????????
Posted: Thu Dec 23, 2004 6:02 am
by mohson
anymore advice for this one guys??
Posted: Thu Dec 23, 2004 6:03 am
by mohson
sorry wrong post - isorted this ages ago!!!!! cheeers