Skip to content
Advertisement

Why does PHP file return “array”, but not its contents

I am tring to send an array to PHP, PHP however, only outputs “array”. I have two files: forms1.php and forms1.js. The PHP if statement never turns true. I have tried without the if statement too.

Thanks for pointing it out in the comments, Yes I call the function, and the alert returns entire forms1.php code.

old title: Why does my php file not see GET[“result”]? // this title is wrong

forms1.js

JavaScript

forms1.php

JavaScript

Advertisement

Answer

nums is an array, elements inside might be sent as individual values and the parameter name is result[], make it a single string by using JSON.stringify

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement