C
C
cyberlain2017-04-21 07:56:18
PHP
cyberlain, 2017-04-21 07:56:18

Why is the content of the form not being sent to modx?

Need help with modx. Designed the site and made a feedback form. For some reason, from static pages (html-ok), the content of the forms was sent, but in the integrated layout - no. Where to dig?
here is ajax

$('.c-feedback-form__footer .e-btn').on('click', function(){
        var form = $(this).closest('form');

        var data = {
            name: form.find("input[name='name']").val(),
            email: form.find("input[name='email']").val(),
            message: form.find("textarea[name='message']").val()
        };

        $.ajax({
            type: "POST",
            url: "mail.php",
            data: data,
            success: function() {
                $(document).find('.iziModal-button.iziModal-button-close').trigger('click');
            }
        });

        return false;
    });

here is php
<?php
  $mailto = '[email protected]';

  $name = $_POST['name'];
  $email = $_POST['email'];
  $message = $_POST['message'];

  $theme = "Заявка от $name";

  $headers = "Content-type: text/plain; charset=UTF-8\r\n";

  $contactMessage = "Поступил новое предложение по почте.
Имя: $name
Почта: $email
Сообщение (если указано): $message";

  mail($mailto, $theme, $contactMessage, $headers);
?>

everything was sent from a static page, and when I tied it to the modex, it stopped working and I don’t understand why =(

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey, 2017-04-21
@masterfreelance

ModX has a great FormIt snippet . Make forms with it.
And it can stop working for a lot of reasons, for example, POST data does not reach mail.php.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question