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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sending link to friend 1

Status
Not open for further replies.
Feb 9, 2001
10
0
0
US
Hi,

I was wondering does anyone know how to have a link on your PHP page that when clicked the person will be able to send the link to a friend. Kind of like referring a friend to the page. Any help would be great.

Thanks in advanced
:)
 
Sure,

just make the link(s) like this:

print(&quot;<a href='sendlink.php?id=1'>The First Link</a><br>&quot;);
print(&quot;<a href='sendlink.php?id=2'>Another Link</a><br>&quot;);
...

or anything similar. Then in the sendlink.php page, you catch the $id variable which contains a cypher, like 2. Then you just match this cypher to the appropriate link, put it in a message body and send it using the mail() funtion.
 
also ....

If you have too many pages, constantly adding pages, or dynamic pages that would make keeping a cross refrence page table:

print(&quot;<a href='sendlink.php?id=$REQUEST_URI'>Send this page to a friend</a><br>&quot;);

The sendlink.php would have then ask the user for the email address, name, etc in a form (dont forget to include $id as a hidden value in the form). The forms action would send all the data to a script that would email (using the mail() function) the information to the designated address.



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top