Jump to content

newsletter problems


divinedesigns1
 Share

Recommended Posts

hey sup, im trying to complete this script, but part of it isnt working, they mail gets send to the person emails but when it comes to the text that was suppose to display that doesnt show this is the code im using

<?php$from = 'ty@ty.com';$subject = $_POST['subject'];$text = $_POST['text'];$conn = mysqli_connect('ty','ty','ty','ty') or die ('We have incounter a error');$query = "SELECT * FROM newsletter";$result = mysqli_query($conn, $query) or die ('problem excuting the query');while($row = mysqli_fetch_array($result)){$firstname = $row['fname'];$lastname = $row['lname'];$msg = "Dear $firstname $lastname, \n $text";$to = $row['email'];mail($to, $subject, $msg, 'from: ' . $from);echo 'You just BASTED emails to: ' . $to . '<br/>';echo 'THANK YOU FOR BLASTING';}mysqli_close($conn);?>

the $msg = "Dear $firstname $lastname, \n $text"; is what is giving me a problem, in the email it displays Dear smith smity,and the rest is blank

Link to comment
Share on other sites

are you sure that $_POST['text'] is not blank? try print_r($_POST) to see what is being sent over
nope its not blank, i got it working but still dont know what was the problem i think i cant use the word text in a variable not too sure who gonna have to check it out, since i got it fixed
Link to comment
Share on other sites

nvm i got it, i used a $_get in the html form, then use a $_post in the php script which didnt work out too well, i guess you cant use $_post and $_get

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...