NameSilo

Super-simple "invite a friend" script?

Spaceship Spaceship
Watch

Ringr

VIP Member
Impact
45
Hey guys,

I am just looking for a very simple (no I don't need anything fancy or complex) PHP script or something of the like, where people can click on a link and it will simply go to a page where people can fill in up to 5 email address and press "send" and then an email will be dispatched to those email addresses with a customized message.

Anyone know where I could get one, or maybe one of you has made something like this?
Once again, please keep things simple I don't need a whole darned complex script with ever bell and whistle on it - just a simple little deal like I said above.

Thanks guys,
I hope someone can help me out;
-Andy M.



P.S. Please don't say "OMG DID YOU CHECK HOTSCRIPTS?!" gees I hate when people say that. I've looked a lot of places including Hotscripts but haven't found anything yet.
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
AfternicAfternic
OMG DID YOU CHECK HOTSCR... oh, sorry.

I'll write one right here, right now ;)

PHP:
<?php
if ( $_SERVER["REQUEST_METHOD"] != "POST" )
{
?>
<h1>Tell a Friend</h1>
<form action="<?= $_SERVER["PHP_SELF"] ?>" method="post">
<table width="100%">
<tr>
<td>Friend's e-mail:</td>
<td><input type="text" name="friend[]" /></td>
</tr>
<tr>
<td>Friend's e-mail:</td>
<td><input type="text" name="friend[]" /></td>
</tr>
<tr>
<td>Friend's e-mail:</td>
<td><input type="text" name="friend[]" /></td>
</tr>
<tr>
<td>Friend's e-mail:</td>
<td><input type="text" name="friend[]" /></td>
</tr>
<tr>
<td>Friend's e-mail:</td>
<td><input type="text" name="friend[]" /></td>
</tr>
</table>
<br />
<input type="submit" value="Send" />
<?php
}
else
{
$subject = "Check this out!"; // E-mail subject
ob_start();
?>
Hello,

Check out our site:
http://www.example.com/

Thanks,
Some siteee!
<?php // Put your e-mail message between the php tags.
$message = ob_get_contents();
ob_end_clean();
$_POST["friend"] = is_array( $_POST["friend"] )? $_POST["friend"] : array();
for( $i = 0; $i < count( $_POST["friend"] ); $i++ )
{
$friend = $_POST["friend"][$i];
mail( $friend, $subject, $message, "From: Some site <[email protected]>\n" );
}
?>
<h1>Tell a Friend</h1>
Thanks for telling your friends, the e-mails have been sent!
<?php
}
?>
 
Last edited:
1
•••
Everytime I say the thing about Hotscripts, at least one person replies like you did. :P
Lol

Crabby, thanks a billion for your help. You have no idea how much it helped me.

Thanks! :D
-Andy M.

---
Edit: I am getting this error:
Code:
Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/flametid/public_html/sa/invite-a-friend.php on line 49
Line 49 is this: foreach( $_POST["friend"] as $friend )

Do you know what might be wrong?
 
Last edited:
0
•••
Meh, anybody?
Sorry I don't know PHP. :/
 
0
•••
EDIT: Can't get it to work, I'll code my own. :p
 
Last edited:
1
•••
Thanks for being so patient :p </sarcasm>

I've updated the post.
 
0
•••
It works!

Thank you Crabby! :)
And thanks for your efforts SecondVersion.

Thanks guys, :)
-Andy
 
0
•••
AndyM3 said:
It works!

Thank you Crabby! :)
And thanks for your efforts SecondVersion.

Thanks guys, :)
-Andy

Yea well :p lol, I got mine wrote, but you don't need it. :hehe: Well, almost, still workin on it. :)
 
0
•••
Just some suggestions...

If you have some people on dial-up that think their invite isn't going through, try to use the Dynamic Drive script to disable the click button.

If you're requesting them to send a message, use JavaScript as well and onClick. That will prevent people from filling out a blank form. Of course, it doesn't stop them from disabling JavaScript. It's always good to use empty() on top of JavaScript.
 
0
•••
Dynadot — .com Registration $8.99Dynadot — .com Registration $8.99

We're social

Unstoppable Domains
Domain Recover
DomainEasy — Payment Flexibility
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back