Is there anyone that could take a look at my code my subscribe php isn't working, I've tried submitting my own e-mail etc and I get nothing, no spam no inbox nothing tried with 3 e-mails, not a single thing. Leaves me to think something wrong with the php code ...
Code:
<?php
header(”Cache-Control: cache, must-revalidate”);
header(”Pragma: public”);
//connect to db
include('db_connect.php');
//get variables from flash
$my_email = $_REQUEST["myEmail"];
$my_email = stripslashes($my_email);
$user_name = $_REQUEST["myName"];
$user_name = stripslashes($user_name);
$my_subscr = $_REQUEST["myStatus"];
//the message that gets sent
$subSubject = "Thanks for joining Farralane's mailing list $user_name!";//subject line if they are subscribing
$unsubSubject = "Mailing list removal confirmation";//subject line if they are being removed
$subBody = "Dear $user_name,\n\nThanks for joining the mailing list!\nWe will periodically send you great deals and special offers.";//body if they are subscribing
$unsubBody = "Dear $user_name,\n\nWe are sorry to see you go. Please consider joining again sometime in the future.";//body if they are being removed
$from = "grandcentral@leftrockdesign.com";//Who the email is from
//search the db for this email
$find_query = "SELECT * FROM $table WHERE user_email = '$my_email'";
$find_result = mysql_query($find_query) or die("Invalid query: " . mysql_error() . "<br>". $find_query);
while($row = mysql_fetch_array($find_result)){
$email = $row['user_email'];
}
if(!$email){
//if this email doesnt exist add it to the db
$new_query = "INSERT INTO $table
(user_email, user_name, user_subscr)
values ('$my_email', '$user_name', '$my_subscr')";
$new_result = mysql_query($new_query) or die("Invalid query: " . mysql_error() . "<br>". $new_query);
}else{
//if the email does exist modify it
$edit_query = "SELECT * FROM `$table`";
$edit_result = mysql_query("UPDATE $table SET
user_subscr='$my_subscr',
user_name='$user_name'
WHERE user_email='$my_email'");
$edit_result = mysql_query($edit_query) or die("Invalid query: " . mysql_error() . "<br><br>". $edit_query);
}
//email conformation
$from = "From: $from\r\n";
if($my_subscr == 1){
$subject = $subSubject;
$body = $subBody;
mail($my_email, $subject, $body, $from);
}else if($my_subscr == 0){
$subject = $unsubSubject;
$body = $unsubBody;
mail($my_email, $subject, $body, $from);
}
?>