Answer the question
In order to leave comments, you need to log in
How to enter email into mail?
Hello! It is necessary for me that the letter came to the client who entered email into a DB. I wrote the code, the form of the return letter, and inserted the variable that is entered into the printf recipient, it does not work, what is the error?
<html>
<head>
<meta charset=utf-8>
</head>
</html>
<?php
if (isset($_POST["submit"])) {
$firstname = $_POST["firstname"];
$email10 = $_POST["email10"];
$tel10 = $_POST["tel10"];
$mes10 = $_POST["mes10"];
$to= require 'cmsadmin/connect.php';
$sql_select = 'SELECT * FROM ordersait';
$result = mysql_query($sql_select);
$row = mysql_fetch_array($result);
do
{
printf("" .$row['email5'] . "");
}
while($row = mysql_fetch_array($result));; //Ваша почта (куда будут приходить письма)
$message = "
$firstname \n
$email10 \n
$tel10 \n
$mes10 \n
";
//Этот текст Вам придет
if ($email10 != 0) { //проверка, ввиден ли email, если да - добавляем в письмо и его
$message .= "\n e-mail: $email10";
}
$from = "From: 24goldsite <24goldsite.ru>\r\nReply-To: [email protected]";
mail($to , "Запрос на домен" , $message , $from) or die("Ошибка в отправке письма");
print "Запрос получен, в течении двух часов, мы с Вами свяжемся";
}
?>
Answer the question
In order to leave comments, you need to log in
Is there an email5 field in the database?
Why do you need mysql_fetch_array twice?
Why use the do...while construct?
could do that
$sql_select = 'SELECT * FROM ordersait';
$result = mysql_query($sql_select);
$row = mysql_fetch_array($result);
print_r($row);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question