Skip to content

Tag: get

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 for…

post request allowed although denied

I started ajax post request to a php file like this: And I get a response, but this should not be possible, because my php file only allows GET instead of POST: Where is my fault? Answer The Access-Control-Allow-Methods header is used in the preflight response to give the client a hint at which methods are al…

how to get value using get method from php

below is url : http://test.com/admin.php?&state=JAMMU+&KASHMIR using get method i want value of parameter state. thanks for help Answer Try the below code Update: To get & as a value in GET variable it first need to be encoded i.e., The url would be

Extracting json string with PHP

JSON string that i received from the API Information that i wanted to extract My attempt The output: Did the JSON string that i received is in bad format? Why does it says undefined property? Appreciate any helps. thanks! Post that i’ve refer to: How do I extract data from JSON with PHP? Answer token is…

Laravel: how to pass GET array to controller?

How to pass array of GET parameters to the controller? This is my route file routes/web.php: And my controller ‘app/Http/Controllers/Parser.php’: So, I expect to get an array of parameters like this: But if I pass GET array to my route path: http://example.com/ids?ids[]=1&ids[]=2&ids[]=15&…

Sending User input from python to php

This is my python file: This is my PHP Script: Problem my python file is not sending userdata to php script. Any help would be appreciated Thank you. Answer The problem is you are sending post data but in PHP script, you are capturing GET data. We can re-write both files like this to send POST data and captur…

How to Set my URL pattern in my php using get method parameters only

I have 3 php files in my directory(/account): index.php login.php signup.php Accessing the folder in my localhost: http:localhost/account ==> opens the default(index.php file) I want to access the login.php and signup.php using: and respectively. Here is my code in the index.php Please help to get me a way…