Hey guyse.
I got this php email problem.
I need to Select an email from a database and send a mail to them.
Like this:
but here comes the problem.Code:$email = $_POST['email'];
$to_email = mysql_query("SELECT email FROM emails WHERE email = '$email'");
$email = mysql_fetch_array($to_email, MYSQL_BOTH);
$to = ;
$subject = 'mail example';
$message = 'example from example with example..';
$headers = From: example@example.com
mail($to, $subject, $message, $headers);
How do i get the email out of the database so i can use it in $to variable.
i need it as the email, as a string, so i will send it correctly.
Thanks !! from flezria
what does the DB look like?
Its a mysql database?
Umm.. it should work..Code:$email = $_POST['email'];
$sql = "SELECT email FROM emails WHERE email='".$email."'";
$to_email = mysql_query($sql);
$email = mysql_fetch_array($to_email);
$to = $email['email'];
$subject = 'mail example';
$message = 'example from example with example..';
$headers = From: example@example.com
mail($to, $subject, $message, $headers);
I got it working.
Just replaced the fetch_array with fetch_row![]()
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks