I have a post value like this.
It is stored in $_POST
.
Now, I need to remove or unset the last array value i.e [submit] => Add
.
When I checked in SOF, they asked me to use array_pop
.
But that didn't work. Any help.
My output:
[56-1] => 0
[56-2] => 0
[56-3] => 0
[submit] => Add
Expected output:
[56-1] => 0
[56-2] => 0
[56-3] => 0
EDITED:
Here is my code
<?php
$my_array = $_POST;
foreach($my_array as $key=>$value){
array_pop($my_array);
unset($key['submit']);
}
print_r($my_array);
?>
Thanks,
Kimz
<?php
unset($_POST['submit']);
?>