How to send the value of the prompt field to the PHP handler on the server to send the message.
For this I wrote the code, but something is missing, the handler does not see the value of the prompt field.
HTML form
<form style="display:none;" id="myform" action="mailer.php" method="POST"> <input type="email" name="email" id="email" value="" /> </form> Javascript
var email = prompt("Ваш e-mail", "@"); if (email != 'undefined') { document.getElementById("email").value; document.forms["myform"].submit(); } Php
if (isset($_POST['submit'])){ //получаем e-mail $email = $_POST['email']; $email = trim($_POST['email']); $email = strip_tags($_POST['email']); $email = htmlspecialchars($email); //проверка пустого поля if (empty($_POST['email'])) exit(); //фильтр e-mail if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { exit(); } //проверка e-mail if (!preg_match("/[0-9a-z_]+@[0-9a-z_\-^\.]+\.[az]{2,6}/i", $_POST['email'])) exit(); mail(...); mail(...); Question: How to send the value of the prompt field to the handler?