B
B
blaobleo2018-07-08 02:48:58
PHP
blaobleo, 2018-07-08 02:48:58

Why do letters come with empty variables?

Emails are not coming. Please see the code:

<form class="form" action="form.php">
   <input class="line" type="text" name="name" placeholder="Ваше имя" required>
   <input class="line" type="tel" name="phone" placeholder="Ваш номер телефона" required>
   <span class="s_color">Выберите цвет:</span>
   <div class="hr"><label><input type="checkbox" value="black" name="i_1"><span id="i_1"></span></label></div>
   <div class="hr"><label><input type="checkbox" value="pink" name="i_2"><span id="i_2"></span></label></div>
   <div class="hr"><label><input type="checkbox" value="blue" name="i_3"><span id="i_3"></span></label></div>
   <button class="submit" type="submit">Купить</button>
</form>

<?php
 
/* Задаем переменные */
$name = htmlspecialchars($_POST["name"]);
$phone = htmlspecialchars($_POST["phone"]);
$i_1 = htmlspecialchars($_POST["i_1"]);
$i_2 = htmlspecialchars($_POST["i_2"]);
$i_3 = htmlspecialchars($_POST["i_3"]);
 
/* Ваш адрес и тема сообщения */
$address = "[email protected]";
$sub = "Сообщение с сайта fidget.ltd";
 
/* Формат письма */
$mes = "Сообщение с сайта ХХХ.\n
Имя отправителя: $name 
Телефон отправителя: $phone
Цвет: $i_1 $i_2 $i_3";

(mail($address, $sub, $mes, $from));

?>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Kazakov, 2018-07-09
@ferym

Yes, the man speaks the matter above)
If you are too lazy to learn materiel or you don’t rummage at all, then replace it with

<form class="form" action="form.php" method="POST">

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question