Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

New to PHP but how do you set up a link in a variable?

Status
Not open for further replies.

graphics4you

Programmer
Jun 21, 2005
3
US
I want to send out e-mails with PHP with a link inside the e-mail. How do you make a variable handle an HTML link? I tried a few things like . . .

This was a test to see if PHP would just print up a link [failed]

echo"<html>a href=href=
or assigning a variable like
$enterLink = "<html><a href=
So whats the proper way to handle links with PHP?
PLEASE HELP
 
It really depends on the mail client that is being used to read the email message. For example, Eudora will see a plain text url [ignore]www.example.com[/ignore] and turn it into a clickable URL automagically.

If you want to send true HTML email, you need to send MIME encoded messages. Many people on this forum usually recommend the PHPmailer class. (google for it)

Ken
 
Well, that almost worked here is the code I used.

echo "<html><a href\"= here</a></html>";

Now we are so close. The Click here shows up as a link (Oh YEAH) but its not linking to So PHP sees the href but can not get the URL out of the address. Any other modifications?
 
You wrote
Code:
echo "<html><a href\"=[URL unfurl="true"]http://www.markcgoodman.com\">Click[/URL] here</a></html>";
You probably want:
Code:
echo '<html><a href[COLOR=red][b]="[/b][/color][URL unfurl="true"]http://www.markcgoodman.com">Click[/URL] here</a></html>';

You had the quote before the equal instead of after. Also, if you use single quotes around your string, you don't have to escape the double quotes.

Ken
 
is the mail headers set corrrectly???

Known is handfull, Unknown is worldfull
 
Thanks for all your help. I think I got something thats going to work out. You all were a big help!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top