Click to See Complete Forum and Search --> : I need a script


chriscam19
04-14-2003, 08:15 PM
Ok i need a "refer a friend" script. I want people to come to my page enter in their friends email address and it will send their friend a link to my site. Anyone have one of these? The last script I had didnt work. I am not that good with php or cgi so I may need help getting it started! It should look something like this:

If you like this site refer a friend:
Friends Email Address:
Friends Name:
Your Email Address:
Your name:

Submit

and then their friend should get a link to my site!

Nevermore
04-15-2003, 05:15 AM
You need a server-side language, e.g. PHP to send a form from a website without opening an email client. Do you have PHP, or do you want to send with the user's email client?

chriscam19
04-15-2003, 05:28 AM
yes I have php good ol' buddy! :)

And yes thats right I need them to send the email without the email client opening up!

pyro
04-15-2003, 07:12 AM
If you plan to help him, cijori, this thread will probably be of use to you, to see what I've already given him, and apparently didn't work... http://forums.webdeveloper.com/showthread.php?s=&threadid=6998

chriscam19
04-15-2003, 07:34 AM
You guys work around the clock!! You guys should form your on tech support company or something! :)

Nevermore
04-15-2003, 08:17 AM
Does anyone know whether or not the server supports PHP mail, because it isnt part of all installations? BTW, chriscam, you never downloaded Pyro's attempt. http://forums.webdeveloper.com/attachment.php?s=&postid=35472

chriscam19
04-15-2003, 10:09 AM
i downloaded that one and it didnt work either!

Nevermore
04-15-2003, 10:41 AM
Do you know if your server supports PHP mail functions?

chriscam19
04-15-2003, 01:03 PM
I have it!

chriscam19
04-15-2003, 01:04 PM
yeah it supports PHP mail functions

guik
04-15-2003, 02:06 PM
ok guy, i may help you... only if you accept javascript code

Nevermore
04-16-2003, 02:51 AM
Put this code in an empty file and name it friend.php


<?php
$theirname=$_POST['theirname'];
$friendname=$_POST['friendname'];
$their_email=$_POST['their_email'];

$bodytext = $theirname . " - " . $friendname . " has recommended that you visit http://www.vegassweethearts.com";

$mail_subject = "Visit Vegas Sweethearts";
$bodytext = stripslashes($bodytext);
mail ($their_email, trim($mail_subject), trim($bodytext));
echo ("<p style='font-size:large; text-align:center; color:red; font-weight:bold;'>Your message has been sent to $their_email<br><br>");
echo ("<a onclick='javascript:history.back()'>Back</a></p>");
?>

And put this code in the file which is going to contain the form:

<form action="friend.php" method="post">
<input name="email" type="text" value="">
<input name="name" type="text" value="">
</form>

chriscam19
04-16-2003, 12:43 PM
the last part that you gave me, the part that goes into the form, do I name that file <something>.php or <something>.html?

chriscam19
04-16-2003, 12:44 PM
dude, why dont I just give you my username and password and you can go into my server and see if you can get a script to work for me. Would that be easier? But like I said I am trying to get

friend email
friend name
your email
your name

comments:


Submit

chriscam19
04-16-2003, 01:50 PM
take a look at this page, goto:

http://www.searchengineguide.com/recommend/1.html

Nevermore
04-17-2003, 06:28 AM
The form can be in an HTML file.

webby
04-17-2003, 06:36 AM
...edit...

Moderator's Note: You will cease and desist from that kind of abuse or risk permanently losing your membership on this site.

chriscam19
04-17-2003, 12:37 PM
did you look at the link I sent you? Do you think you could get that script to work on my site?

chriscam19
04-22-2003, 02:17 PM
I did what you said. But if the html file there is no submit button. So all your html file allows me to do is just enter in information and not submit it.

Put this code in an empty file and name it friend.php



PHP:--------------------------------------------------------------------------------

<?php
$theirname=$_POST['theirname'];
$friendname=$_POST['friendname'];
$their_email=$_POST['their_email'];

$bodytext = $theirname . " - " . $friendname . " has recommended that you visit ...;

$mail_subject = "Visit Vegas Sweethearts";
$bodytext = stripslashes($bodytext);
mail ($their_email, trim($mail_subject), trim($bodytext));
echo ("<p style='font-size:large; text-align:center; color:red; font-weight:bold;'>Your message has been sent to $their_email<br><br>");
echo ("<a onclick='java script:history.back()'>Back</a></p>");
?>

--------------------------------------------------------------------------------


And put this code in the file which is going to contain the form:

code:--------------------------------------------------------------------------------
<form action="friend.php" method="post">
<input name="email" type="text" value="">
<input name="name" type="text" value="">
</form>

Nevermore
04-23-2003, 10:46 AM
oops... Put a submit button on the form.
Hehe...

;)