I'm studying with a book use the head and the following practically copied and pasted the sample code just changing the names of the variables and I'm not having the return with my code, actually what appears in my final result is email Sent to: 3x this because I have 3 entries in my database, but the values are not being placed inside the variables logo, the function is not working right, is not sending email nor return email sent to: [email protected] Since I thank you already.
<?php
$de = '[email protected]';
$assunto = $_POST['assunto'];
$texto = $_POST['elvismail'];
/*creating connection*/
$conexao = mysqli_connect('localhost', 'root', 'password', 'ELVIS_STORE')
or die ('Erro ao conectar o banco');
/*command SQL*/
$query = "SELECT * FROM LISTA_EMAIL";
/*getting result*/
$result = mysqli_query($conexao, $query) or die ('erro na segunda etapa');
while ($row = mysqli_fetch_array($result))
{
$para = $row['email'];
$nome = $row['nome'];
$sobrenome = $row['nome'];
mail($para, $assunto, $texto, 'De: ' . $de);
echo 'Email sent to: ' . $para . '<br />';
}
mysqli_close($conexao);
?>