I
I
insanel2019-09-30 17:48:37
PHP
insanel, 2019-09-30 17:48:37

How to process incoming object in phpmailer?

This is how the form data is sent to phpmailer:
5d92149fe97ce625394438.png
This is if the form is written in pure js
This is how it is sent if it is sent to jquery:
5d9214ca89e7b506343957.png
1) phpmailer cannot recognize the lines

$name = $_POST["name"];
$email = $_POST["email"];
$number = $_POST["tel"];

and sends an empty letter, without this data
2) Everything works, the lines above are correctly defined
I don’t understand php myself
The task is to do without jquery
I already wrote a question on the toaster about how to convert form data into the same form as at jquery, but no one answered.
Perhaps this object can be processed somehow in php

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
insanel, 2019-10-04
@insanel

It was necessary to accept not with $_POST , but with php://input

T
ThunderCat, 2019-10-01
@ThunderCat

This is your string in json format, so if you want to process it using php, convert it to an array or php object.
json_decode()
UPD: most likely everything is fine with you, you just look for some strange fields in $_POST, send selectmaterial, and look for email, etc. In the code, before assigning, do var_dump($_POST), and see what you got.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question