This is pretty much the same thing as a "Share this page with a friend" This is what I use. Now you'll have to modify it to work in your situation, but I don't think that should be to hard.
HTML Code:
<form action="refer.php" method="post">
<p>Page you are sending:
<?php $fullurl = $_SERVER['HTTP_REFERER'];
echo "<a href='$fullurl'>$fullurl</a>" ;
echo"<input type='hidden' name='link' value='$fullurl'>";?>
<br>
<br>
</p>
<table width="50%" border="0" cellspacing="4" cellpadding="0">
<tr>
<td width="50%">Friend's Name:</td>
<td width="50%">
<input type="text" name="name" class="formbox">
</td>
</tr>
<tr>
<td>Friend's E-mail:</td>
<td><input type="text" name="email"class="formbox" ></td>
</tr>
<tr>
<td>Your Name:</td>
<td><input type="text" name="sendername" class="formbox"></td>
</tr>
<tr>
<td>Your E-mail:</td>
<td><input type="text" name="senderemail" class="formbox"></td>
</tr>
</table>
<p> Your Message:<br>
<textarea name="message" cols="50" rows="5" class="formbox"></textarea>
<br>
<input type="submit" name="submit" value="Send Page" class="btn">
<input type="reset" value="Reset" class="btn">
<input type="button" value="Back to Page" class="btn" onClick="history.go(-1)">
</p>
</form>
refer.php
PHP Code:
<?php
if(isset($_POST['submit'])) {
$headers = 'From: System Admin <noreply@domain.com>';
$to = $_POST['email'];
$sendername = $_POST['sendername'];
$senderemail = $_POST['senderemail'];
$name = $_POST['name'];
$email = $_POST['email'];
$link = $_POST['link'];
$message = $_POST['message'];
$signature = "Thank You, ";
$from = "Share-This-Page@yourpage.com";
$subject = "$sendername thought you might like this page!";
$body = "Hi $name, $sendername at $senderemail thought you might be interested in the page found at $link\r\nThey wrote the following message for you:\r\n $message";
mail($to, $subject, $body, "From: $from");
echo "<div align=\"center\"><table width=\"96%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" ";
echo "style=\"font-size:11pt;font-color:black;\">";
echo "<tr height=\"40\" align=center><td><p> </p></td></tr>";
echo "<tr><td >An e-mail was sent to $name (<a href=\"mailto:$email\">$email</a>), We hope they will enjoy the page at";
echo " <a href=$link target=_blank>$link </a><br><br>Your message was:<br>$message";
echo "<CENTER><FORM><INPUT type='button' value='Back to Page' class='btn' onClick='history.go(-2)'></FORM></CENTER>";
echo "</td></tr></table></div>";
}
else echo "You shouldn't link to this page directly";
?>
Bookmarks