codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:



Home » ASP » Article

ASP Tell a Friend Script

Article by:  Jeff Anderson  ( 1362 ) (10/15/2001)
Bookmark us now! Add to Favourites
Email a friend!Tell a friend
Sponsored by: Neil Matthews Hypnotherapy, Wilmslow
Summary: This is an ASP Script simply to be used on your pages to allow users to email an article or page they've seen on your site. This Script also use JavaScript to validate the form.
Viewed: 48107 times Rating (4 votes): 
 3.9 out of 5
 Rate this Article  Read Comments  Post Comments


Tell-a-friend scripts are used to allow surfers to pass on details of the page they are visiting to their friends via a neat pop up box. This brings more precious traffic to your site and makes it look that little bit more professional.

First you will need to create a javascript pop-up function :




Select All Code


Let's say we want to provide a tell a friend script for this page http://www.codetoad.com/asp/tell_a_friend.asp

We will need to include the above function in the <head> tag of the page. Then, to create the link itself we need to encode the current page url and pass it to the tell_a_friend_script page :

<a href="javascript:TellFriend('http://www.codetoad.com/asp/tell_a_friend_script.asp?page=<%
Response.write server.URLEncode("http://www.codetoad.com/asp/tell_a_friend.asp")
%>')"><B>Tell a friend about this page!</B></a>



Tell a friend about this page!

The page tell_a_friend_script.asp will be the page that appears in the pop up window. To create the page, the following asp page consists of a form to gather the senders details and message. The page is submitted itself and displays a thankyou message to the user once the email has been sent.

Select All Code









CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums
Rate this article:     Poor Excellent
View highlighted Comments
User Comments on ' ASP Tell a Friend Script'
Posted by :  David Bruce at 06:05 on Thursday, November 07, 2002
There was a line missing in the javascript which we've now corrected - the code should now work fine!
Cheers
Dave
Posted by :  Archive Import (Robert) at 15:23 on Thursday, November 07, 2002
Hi, Dave:

This code is still not working... In the pop up, the "Additional message" box is showing the following code:

</td>
</tr>
<TR><td height="5" colspan="2"></td></tr>
<TR>
<td></td>
<td align="left" valign="top">
<input type="hidden" name="page" value="http://www.amerigold.com/ag_market_report/ag_market_report.asp">

<input type="Submit" value="Send It"></td></tr>
</table></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</form>
<p>

</BODY>
</HTML>
Posted by :  Archive Import (Kenny) at 15:09 on Friday, January 10, 2003
Hi yea,
I have mine working but http://www.spudnic.com for the sample , but is there anything I can to to give me the complet address ie http://localhost/swan_server/pics2.asp?imgdate=12/24/02 and not just http://localhost/swan_server/pics2.asp , If you could do anything I would be grateful. regards

Kenny
Posted by :  Archive Import (Vikas) at 20:35 on Friday, January 10, 2003
trying it dude
Posted by :  Archive Import (cmj) at 15:05 on Saturday, January 11, 2003
these are my comments
Posted by :  Archive Import (elvis) at 06:37 on Friday, January 24, 2003
I tried the above code, it works but it taqkes ages for the window to pop up, it is not my ISP as far as i am aware as all my other pop up windows work a treat. any ideas.

thank you very much

Elvis
Posted by :  Archive Import (Kenny) at 07:38 on Friday, January 24, 2003
Well it kinda works but I thought it was going to pass the http_referer , ie the email being sent would contain the full http address along with the query string but sadly this is not the case, this script seems to only send a fixed http address which the web master has to olace in the code first. if any one here knows where I can get a good pop up send to friend code that sends the full address of a page on completion of a form I would be most grateful, I have being on this for the lst two weeks and it is really driving me behind.

Regards

Kenny
Posted by :  Archive Import (Thomas) at 09:13 on Thursday, May 08, 2003
Can't this be done much easier with an ASP mailsender script?
Posted by :  Archive Import (Melody) at 20:15 on Thursday, June 05, 2003
This script is still messed up and still showing the following in additional comments box:

</td>
</tr>
<TR><td height="5" colspan="2"></td></tr>
<TR>
<td></td>
<td align="left" valign="top">
<input type="hidden" name="page" value="http://www.amerigold.com/ag_market_report/ag_market_report.asp">

<input type="Submit" value="Send It"></td></tr>
</table></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</form>
<p>

</BODY>
</HTML>
Posted by :  Archive Import (Tim) at 14:04 on Saturday, July 12, 2003
This script looks like it will be sweet if it worked right.. I don't know enough about ASP yet to fix it but I am still getting HTML tags in the message box... If I could help I would.. Good Luck Guys.
Posted by :  Archive Import (marc) at 18:06 on Friday, August 08, 2003
HTML tags in the message box...

In approx line 107 of the code you will find "%gt;" after the 5. Replace this with > and the code should work.

eg..
it now reads
<textarea name=message maxlength=500 cols=24 rows=5%gt;</textarea>

should read
<textarea name=message maxlength=500 cols=24 rows=5></textarea>
Posted by :  clasico at 11:38 on Thursday, December 25, 2003

Hello -- I noticed a small typo in the code for the tell_a_friend_script.asp

In the section for the textbox, the code has the following:

<textarea name=message maxlength=500
cols=24 rows=5%gt;</textarea>

The code should have a ">" after the "rows=5" -- see example here:

<textarea name=message maxlength=500
cols=24 rows=5></textarea>

Otherwise, without this change, the textbox will show a lot of code.
Posted by :  psjunta at 11:45 on Saturday, June 24, 2006
Is it me, or how can you make it call the specific page that it is on? As of now, it only goes to the stated address that you pass from the javascript <a href code.

Thank you for any help!
Paul


To post comments you need to become a member. If you are already a member, please log in .

 



RELATED ARTICLES
ASP FilesystemObject
by Jeff Anderson
An introduction to the Filesystemobject
ASP Format Date and Time Script
by Jeff Anderson
An ASP script showing the variety of date and time formats possible using the FormatDateTime Function.
Email validation using Regular Expression
by Jeff Anderson
Using regular expression syntax is an exellent way to thoroughly validate an email. It's possible in ASP.
Creating a Dynamic Reports using ASP and Excel
by Jeff Anderson
A simple way to generate Excel reports from a database using Excel.
ASP OpenTextFile
by Jeff Anderson
An introduction to the OpenTextFile Method of the FileSystemObject
Create an ASP SQL Stored Procedure
by Jeff Anderson
A beginners guide to setting up a stored procedure in SQL server and calling it from an ASP page.
Creating an SQL Trigger
by Jeff Anderson
A beginners guide to creating a Trigger in SQL Server
ASP Shopping Cart
by CodeToad Plus!
Complete source code and demo database(Access, though SQL compatible) to an ASP database driven e-commerce shopping basket, taking the user through from product selection to checkout. Available to CodeToad Plus! Members
Concatenate strings in sql
by Jeff Anderson
A brief introduction to concatenating strings in an sql query (using SQL server or access databases).
The asp:checkbox and asp:checkboxlist control
by David Sussman, et al
Checkboxes are similar to radio buttons, and in HTML, they were used to allow multiple choices from a group of buttons.








Recent Forum Threads
• Re: Insert Contents of .txt file into a .html page
• Re: Perl regular expression problem.
• Re: Problems in login using WWW::Mechanize
• searching for gd::graph guide
• Re: ARRAY OF HASHMAPS
• Adv. Regexp or Otherwise
• Adv. Regexp or Otherwise
• I need help pleasee! My project is about using I/o Stream
• Help Running VB script in Windows 2003


Recent Articles
ASP GetTempName
Decode and Encode UTF-8
ASP GetFile
ASP FolderExists
ASP FileExists
ASP OpenTextFile
ASP FilesystemObject
ASP CreateFolder
ASP CreateTextFile
Javascript Get Selected Text


© Copyright codetoad.com 2001-2008