Send data from form to email

I have problem with send data from page. Web page is responsible and form is ok when fill on the mobile.
When fill form in computer (i have 2 layers, 1-320 px to 1100px width and 2-over 1100px) data form is empty.

	 hypeDocument.getElementById('resultBox').innerHTML = "";	
var name = hypeDocument.getElementById('name').value;
var email = hypeDocument.getElementById('email').value;
var phone = hypeDocument.getElementById('phone').value;
var message = hypeDocument.getElementById('message').value;

var obj = new Object();
var PostName = name;
var PostemailAddr =email;
var Postphone = phone;
var Postmessage = message;
phpEmailer(PostName, PostemailAddr,Postphone,Postmessage);
function phpEmailer(PostName, PostemailAddr,Postphone,Postmessage){

$.post("./email2.php", { name: PostName, email: PostemailAddr,phone: Postphone,message: Postmessage} )

 .done(function() {
 hypeDocument.getElementById('resultBox').innerHTML = "Odoslané!" ;

.fail(function() {
//do anything on failure ...
 hypeDocument.getElementById('resultBox').innerHTML = "Neodoslané!";

PHP file:

    // define variables and set to empty values
    if ($_SERVER["REQUEST_METHOD"] == "POST") {

        $email = $_POST["email"];
        $name = $_POST["name"];
        $phone = $_POST["phone"];

        $message = $_POST["message"];


    $subject = "Dotaz z web stránky";
    $headers = "From: $email\n";
    $to = "";
    $body = "Zákaznik odoslal mail z vášho webu.\n

  Email : $email\n
Meno: $name\n
Správa: $message


    #send confirmation email to users email address
    $user = "$email";
    $usersubject = "ÄŽakujem";
    $userheaders = "From:\n";
    $usermessage = "Ďakujem za návštevu našej stránky.";

    echo "$user";


if the form is not part of a persistent symbol the elements will be duplicated for each layout.
so an approach using id’s to grap the elements data will not work.

use a persistent symbol
work with class instead (the extensionthread includs a nice method to get the current layout/scene to query … )

1 Like

Thank you very much. It’s working now!