-1

I am passing an array to http post from my android app to php server as follows:

params.add(new BasicNameValuePair("image[]", encodedImage));

Now I want all the values on image array, in my php code. How to achieve that?

How to write code for this?- I wanted to loop over this array and insert each image from image[] in php.

when I am trying to do

if(isset( $_POST['image'] )){
$images = array($_POST['image']);
  while($row = $images){
  //insert into table
  }
}

But this is not helping

This if condition for isset is failing.

pagalpanda
  • 150
  • 2
  • 16
  • If you're passing through http post, everything you need is inside `$_POST`. – al'ein Aug 26 '15 at 20:03
  • Show us some PHP code! – RiggsFolly Aug 26 '15 at 20:04
  • 1
    Based on your edit, first you code it like `"; print_r($_POST);`, then you save it like `server.php`, then you make sure your android app is pointing its post request to it, then you open it in a browser and then you'll see it. If a beautiful array is printed on the screen, you've made it. Now all you have to do is manipulate the `$_POST` superglobal to fit your needs. – al'ein Aug 26 '15 at 20:08
  • when I am trying to do if(isset( $_POST['images'] )){ $images = array($_POST['images']); while($row = $images){ //insert into table } } But this is not helping – pagalpanda Aug 26 '15 at 20:45

1 Answers1

0

Try this: if this works

if(isset($_POST['images'])){
  $images[] = $_POST['images'];

while($row = $images){
  //your query here
}
aldrin27
  • 3,407
  • 3
  • 29
  • 43