I used FormData to post the data of a form to a php file. The form in the html is:

<form id='upload' action='php_add.php' onsubmit='postdata()' method='POST' enctype='multipart/form-data'>
<input type='text' id='name'>

function postdata() {
var formElements = document.getElementByID("upload");
var url = formElement.action;
var request = new XMLHttpRequest();
request.open("POST", url);
var formdata = new FormData();
for (var name in data) {
if (!data.hasOwnProperty(name)) continue;
var value = data[name];
if (typeof(value) === "function") continue;
formdata.append(name, value);

When I push the "submit" button in the html, I got two error messages.

Do I need to process inputs, like escape('input text') to get the correct input format?

2. php_add.php
The character encoding of the HTML document was not declared. The document will render with garbled text in some browser configurations if the document contains characters from outside the US-ASCII range. The character encoding of the page must be declared in the document or in the transfer protocol.
For this error message, I already add <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="encoding" content="utf-8">
Also, I tried add <meta...> on the php_add.php file, but the error is still there.

Any suggestion is very welcome! Thanks!