-1

here is a sample the array I have

Array ( [57] => 0 [58] => 0 [59] => 0 [60] => 0 [61] => 0 [62] => 0 [63] => 0

The value names are randomly generated I want to get the name of each pair out of the array and the value I can get the value using

foreach ($_POST as $songvalue) {
print $songvalue;

}

But how do I get the name of the value

Tom Bruton
  • 17
  • 5

3 Answers3

1

If I understand correctly, with :

foreach ($_POST as $key=>$songvalue) {
    print $key;
}
Cyril N.
  • 37,442
  • 34
  • 128
  • 228
1
foreach($_POST as $key => $value){
 //do thingies. $key is your key name
}

You are welcome :)

Warzyw
  • 329
  • 3
  • 11
0

Use foreach($_POST as $key => $value)

Stev
  • 1,032
  • 10
  • 23