S
S
spike3642014-06-25 15:16:24
PHP
spike364, 2014-06-25 15:16:24

How to send data to email from multiple forms?

The site has 2 forms for sending user data to the owner's email.
I implemented the first one as usual with ajax + php script, but how to make the second one? I press submit, ajax says that everything is ok, dude, but the request is sent overtime and, of course, nothing comes to the mail.
794fa3847357478896ddfe95c9dba06a.png

Sorry for the noob question, but tomorrow is the deadline and I will survive the tomatoes flying at me :)

Answer the question

In order to leave comments, you need to log in

3 answer(s)
V
V_Kotkovets, 2014-06-25
@V_Kotkovets

Why can't you just use one form? maybe something is wrong with the architecture.

Z
Zetyara, 2014-06-25
@Zetyara

Do you need to submit 2 forms at the same time? One way or another, the meaning is the same with the help of js, you searelize a form or 2 forms and send ajax to a php script.

S
spike364, 2014-06-29
@spike364

Artisanally solved the problem: I came across a simple ready-made script

<?php
$email_to =   '[email protected]';
$medname     = htmlspecialchars ($_POST['medname']);
$docname    = htmlspecialchars  ($_POST['docname']);
$rank  = htmlspecialchars  ($_POST['rank']);
$docplan  = htmlspecialchars  ($_POST['docplan']);

$headers  = "From: $email\r\n";
$headers .= "Reply-To: $email\r\n";

if(mail($email_to, $medname, $docname, $rank, $docplan)){
    echo 'sent';
}else{
    echo 'failed';
}
?>

no data is sent from
<select id="docPlan" class="form-control btn-group-lg selectpicker" name="docplan" data-style="btn-empty">
                                              <option value="" disabled selected>Выберите набор</option>
                                              <option value="basic">Базовый - 500 руб.</option>
                                              <option value="standart">Стандартный - 1000 руб.</option>
                                              <option value="advance">Премиум - 2000 руб.</option>
                                          </select>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question