Hi there,
I am calling this php script which is not called always with the same ammount of parameters. Is there a way to get all the POST parameters in an array or in a way iterate through them so i get them all every time?
Thanks
count POST parameters [Solved]
Moderator: General Moderators
count POST parameters [Solved]
Last edited by sarris on Wed May 09, 2007 7:42 am, edited 1 time in total.
I'm not entirely sure what you mean.
You can count POST parameters quite easily:
You can count POST parameters quite easily:
Code: Select all
$number = count($_POST);- CoderGoblin
- DevNet Resident
- Posts: 1425
- Joined: Tue Mar 16, 2004 10:03 am
- Location: Aachen, Germany
As for stepping through them...
the $_POST is a "Read only" array although you cannot change any values you can perform most array functions on it.
Code: Select all
foreach ($_POST as $key=>$value) {
echo "POST input {$key} has a value of [{$value}]<br />";
}This script disagrees:CoderGoblin wrote:the $_POST is a "Read only" array although you cannot change any values you can perform most array functions on it.
Code: Select all
<?php
print "<pre>";
print_r($_POST);
$_POST['bob'] = "changed!";
print_r($_POST);
print "</pre>";
?>
<form method="post">
<input type="text" name="bob" />
</form>Code: Select all
Array
(
[bob] => cake
)
Array
(
[bob] => changed!
)- CoderGoblin
- DevNet Resident
- Posts: 1425
- Joined: Tue Mar 16, 2004 10:03 am
- Location: Aachen, Germany