PDA

View Full Version : Need Help with Multiple Recipient Tell-A-Friend Form


Rickard19
05-13-2003, 12:41 AM
Hello,

I'm attempting to make a Tell-A-Friend form for my webpage. I'm able to make it work with one recipient, but I want them ( the visitors) to be able to fill out a Tell-A-Friend form for like 5 of their friends. I have no clue on how to impliment this using javascript and I need all the help I can get. The HTML Coding below is what I want my Form to look like, but have no clue on how to even begin to code this.

Thank You very much for your time, your help, and a possible response. Have a good week.

Rich

<html>
<head>
<title>Tell-A-Friend</title>
</head>
<body>
<form method="POST" action="">

<table width=360 cellpadding=0 cellspacing=5 border=0>


<tr valign=top>
<td align=right valign=bottom>your name:&nbsp</td>
<td valign=top><input class="textbox" type=text name="name"></td>
</tr>
<tr valign=top>
<td align=right valign=bottom>your email:&nbsp</td>
<td valign=top><input class="textbox" type=text name="from"></td>
</tr>
<tr valign=top>
<td align=right valign=top colspan=2><IMG src="images/spacer.gif" height=10 width=1></td>

</tr>
<tr>
<td colspan=3><hr size=1 color="#00008A"></td>
</tr>
<tr>
<td colspan=3 align=left>Please enter names & email addresses for up to 5 friends.</td>
</tr>
<tr>
<td colspan=3 align=center>friend's name<img src="images/spacer.gif" width=60 height=1>friend's email</td>
</tr>
<tr>
<td colspan=3 align=center><input class="textbox" type="text" name="tname1" size = 20><img src="images/spacer.gif" width=10 height=1><input class="textbox" type="text" name="to1" size = 20></td>
</tr>
<tr>
<td colspan=3 align=center><input class="textbox" type="text" name="tname2" size = 20><img src="images/spacer.gif" width=10 height=1><input class="textbox" type="text" name="to2" size = 20></td>
</tr>
<tr>
<td colspan=3 align=center><input class="textbox" type="text" name="tname3" size = 20><img src="images/spacer.gif" width=10 height=1><input class="textbox" type="text" name="to3" size = 20></td>
</tr>
<tr>
<td colspan=3 align=center><input class="textbox" type="text" name="tname4" size = 20><img src="images/spacer.gif" width=10 height=1><input class="textbox" type="text" name="to4" size = 20></td>
</tr>
<tr>
<td colspan=3 align=center><input class="textbox" type="text" name="tname5" size = 20><img src="images/spacer.gif" width=10 height=1><input class="textbox" type="text" name="to5" size = 20></td>
</tr>
<tr>
<td colspan=3><hr size=1 color="#00008A"></td>
</tr>
<tr>
<td colspan=2 align=left>Please enter your message.</td>
</tr>
<tr>
<td colspan=3 align=center><textarea class="textbox" name="addtxt" wrap="virtual" rows=4 cols=42 maxlength="500"></textarea></td>
</tr>

<tr>

<td colspan=2 align="right"><input class="textbox" type="reset" value="clear form" name="b2"><input class="textbox" type="submit" value="send" name="send"><img src="images/spacer.gif" width=18 height=1><br><br></td>
</tr>

</table>
</form>
</body>
</html>

Spudhead
05-13-2003, 10:06 AM
How, exactly, are you able to make it work with one recipient? Post the code you're using. It's possible to make it work client-side; just rig up a script that will concatenate a list of email addys and shove a "mailto:" in front of it. But that's clunky and unreliable. Use server-side code if possible for increased control and stability.

Rickard19
05-13-2003, 11:08 PM
Hi Spud,

Here is how I'm able to do it with one recipient. It looks nothing like the one I posted. I got it from a free javascript site. I'm just curious if a similar code can be written, so it can accept it sending to multiple recipients.

Here is the coding I'm currently using.

Thanks again for your time and your help and a possible response.

Rich

Coding:
--------------------------------------------------------------------

<html>
<head>
<title></title>

<SCRIPT LANGUAGE="JavaScript">

<!-- Begin
function initMail(form) {
text = "Check out this page: http://www.example.net" ;
form.message.value = "Hi " + form.sendto.value + " (" + form.to.value + "):\n\n"
+ text + "\n\nYour Friend,\n" + form.sendername.value + "(" + form.senderemail.value + ")";
return (form.to.value != "");
}
// End -->

</script>
</head>

<body>

<center>
<form name=emailform method=post action="http://cgi.freedback.com/mail.pl" target="_new" onSubmit="return initMail(this)">
<input type=hidden name=subject value="** Check Out This Site! **">
<input type=hidden name=message value="">
<table>
<tr><td colspan=2 align=center><font face="Tahoma" size="1"><b>Tell a friend about this page!</b></td></tr>
<tr><td><font face="Tahoma" size="1">Their Name:</td><td><input type=text name=sendto></td></tr>
<tr><td><font face="Tahoma" size="1">Their Email:</td><td><input type=text name=to></td></tr>
<tr><td><font face="Tahoma" size="1">Your Name:</td><td><input type=text name=sendername></td></tr>
<tr><td><font face="Tahoma" size="1">Your Email:</td><td><input type=text name=senderemail></td></tr>
<tr><td colspan=2 align=center><input type=submit value="Ok!"><td></tr>
</table>
</form>
</center>
</body>
</html>