I am having a lot of trouble retreiving a Javascript Post in a php file.
I have a function that is getting some values from the DOM and they are stored in variables. See next code.
     const elements = textList.childNodes
     Array.from(elements).forEach(function (element) {
       const item = element.attributes
       let itemClass = element.className
       let itemId = element.dataset.id
       let itemStyle = element.style.height
   
       const data = { name: itemClass, id: itemId, height: itemStyle }
       console.log(data)
       console.log(JSON.stringify(data))
       fetch('http://localhost/fumiko/admin/create-product.php', {
         method: 'POST',
         headers: {
           'Content-Type': 'application/json',
         },
         body: JSON.stringify(data),
       })
         .then((data) => {
           console.log('Success:', data)
         })
         .catch((error) => {
           console.log('Error:', error)
         })
     })
   }
In the console I get a succes message:
Success: Response { type: "basic", url: "http://localhost/fumiko/admin/create-product.php", redirected: false, status: 200, ok: true, statusText: "OK", headers: Headers, body: ReadableStream, bodyUsed: false
But then in the php file.. How do I get the values send from the POST request so that I can store them in phpmyadmin database.
I made the database connection, that is working, but then ... I tried several things, also several ways of sending the data. but this is giving a success messages so I figure I am on the right way. Any tips, advice? MORE then welcome!
 
    