This is the "tell a friend" php script code that i got. I had it ran on my other website server and it worked. so, i have no idea why it dosen't work on this server, please help!!
and the location of this script can be tested here:
<?php
/ **************************************************
- tellafriend.php *
~~~~~~~~ * - File Info: Tell a friend about a particular product
-
**********************************************
**********************/
session_start();
include("admin/config.php");
include( "admin/settings.inc.php");
include( "shoppingcart.php");
include( "header.inc.php");
$cart = new Cart;
include("subheader.inc.php");
// start border
sb("100%","Tell a Friend",$colour_1,$colour_2);
$select = mysql_query ("select * from ".$prefix."store_inventory where product='$product'");
$row = mysql_fetch_array($select);
$title=$row["title"];
// navigation
echo"<a href=\"store.php\" target=\"_self\">Store Home</a> > Tell a Friend<br>";
// if tell a friend for has been submit
if($submit){
// validate recipient e-mail
if ((!ereg("[a-zA-Z0-9.]+@[a-zA-Z0-9-]+.[a-zA-Z0-9-.]+$", $recip_email))or(empty($recip_email)))
{
Echo "<p><div align='center'><font color=#990000><b>Either no recipient email was entered or it was not valid!</b></font></p>";
$again=1;
}//end validate email
// validate senders email
if ((!ereg("[a-zA-Z0-9.]+@[a-zA-Z0-9-]+.[a-zA-Z0-9-.]+$", $from_email))or(empty($from_email)))
{
Echo "<p><div align='center'><font color=#990000><b>Either no email was entered or it was not valid!</b></font></p>";
$again=1;
}//end validate email
// ensure names have been entered
if ((empty($from_name))or(empty($recip_name)))
{
Echo "<p><div align='center'><font color=#990000><b>All parts of the form must be completed!</b></font></p>";
$again=1;
}
// display link if error occurred
if ($again==1)
{
echo"<p align=\"center\"><a href = \"tellafriend.php?session=$session&product=$product\">Click here to try again</a></p>";
} // end ($again==1)
// if user did not enter a message
if(empty($message))
{
$message="Dear $recip_name,\n\n$from_name has sent you this email to direct your attention to the product '$title'.\n";
}
// build message
if(empty($again)){
$subject = "Message from: $from_name";
$message .= "\r\nPlease follow the link below to see this product:\n-----------------------------------------------------------------\n\n$site_url/view_product.php?product=$product\n\n-----------------------------------------------------------------";
// send mail
mail($recip_email, $subject, $message, "From: $from_email");
// confirmation message
echo"<p align=\"center\">Your email about \"<b>$title</b>\" has been successfully sent to <b>$recip_email</b>!<br><br><a href=\"view_product.php?product=$product\" target=\"_self\">Back to product</a></p>";
}
}//end if submit
// display tell a friend form
if(!$submit){
if(session_is_registered(valid_user))
{
$select = mysql_query ("select from ".$prefix."store_customer where email='$valid_user'");
$row = mysql_fetch_array($select);
$from_name=$row["name"];
$from_email=$row["email"];
}
echo"<p align=\"left\">Email a friend about the product \"<b>$title</b>\" using the form below:</p>";
echo"<form action=\"tellafriend.php?session=$session&product=$product\" method=\"post\" enctype=\"multipart/form-data\" name=\"form1\" target=\"_self\">
<table width=\"450\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\">
<tr>
<td width=\"150\" align=\"left\"><strong>Friend's Name:</strong></td>
<td><input name=\"recip_name\" class=\"textbox\" value=\"$recip_name\" type=\"text\" size=\"30\" maxlength=\"30\"><font color=\"#990000\"> </font></td>
</tr>
<tr>
<td width=\"150\" align=\"left\"><strong>Friend's Email:</strong></td>
<td><input name=\"recip_email\" value=\"$recip_email\" type=\"text\" class=\"textbox\" size=\"30\" maxlength=\"30\"><font color=\"#990000\"> </font></td>
</tr>
<tr>
<td width=\"150\" align=\"left\"><strong>Your Name:</strong></td>
<td><input name=\"from_name\" value=\"$from_name\" type=\"text\" class=\"textbox\" size=\"30\" maxlength=\"30\"><font color=\"#990000\"> </font></td>
</tr>
<tr>
<td width=\"150\" align=\"left\"><strong>Your Email:</strong></td>
<td><input name=\"from_email\" value=\"$from_email\" type=\"text\" class=\"textbox\" size=\"30\" maxlength=\"30\"><font color=\"#990000\"> </font></td>
</tr>
<tr>
<td align=\"left\" valign=\"top\"><strong>Your Message:</strong><br>
(A link to the product will automatically be added!)</td>
<td valign=\"top\"><textarea name=\"message\" value=\"$message\" cols=\"45\" rows=\"5\" id=\"message\"></textarea></td>
</tr>
<tr>
<td width=\"150\" align=\"left\" valign=\"top\"> </td>
<td><input type=\"submit\" name=\"submit\" class=\"submit\" value=\"Email Friend!\"><br><font color=\"#990000\"></font> Indicates a required field!</td>
</tr>
</table>
</form>";
}//end if no submit
// end border
eb();
include("subfooter.inc.php");
include("footer.inc.php");
?>