Dean Hall wrote
> Instead of 'array_push', do this:
>
> $input[$key] = $val;
>
Hey thanks dean that did the trick, I was trying:
$array[] = $key . "=>" . $val
which of course doesn't work hehe.
Regards
Joseph
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EM
Joseph.
"Joseph Blythe" <[EMAIL PROTECTED]> wrote:
...
> Ok fine, I now have an associative array with a numeric index, but
> hangon I wanted to push the key => value into the array. How would I do
> this, I have tried a couple of things but am having some really crazy
> results ;-)
'array_push'
Peter Houchin wrote:
> what about if you assign the key to = the id (if in a data base)?
>
> maybe like
>
> while (list ($key, $val) = each ($id)) {
> if ( $key != "Submit" ) {
>
>>array_push($input, $val);
>>}
>>
>> }
>
I am not using a database for this part as I am just collect
ECTED]]
Sent: Tuesday, April 17, 2001 3:40 PM
To: Peter Houchin
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] array_push but with key, value pairs
Peter Houchin wrote:
> maybe tring this ...
> $input = array();
>
> reset ($HTTP_POST_VARS);
>
> while ( list($key, $v
Peter Houchin wrote:
> maybe tring this ...
> $input = array();
>
> reset ($HTTP_POST_VARS);
>
> while ( list($key, $val) = each($HTTP_POST_VARS) ) {
>if ( $key != "Submit" ) {
>array_push($input, $val);
>}
>
> }
Hmm, as far as I can see this will just reset the internal pointe
maybe tring this ...
$input = array();
reset ($HTTP_POST_VARS);
while ( list($key, $val) = each($HTTP_POST_VARS) ) {
if ( $key != "Submit" ) {
array_push($input, $val);
}
}
Peter
-Original Message-
From: Joseph Blythe [mailto:[EMAIL PROTECTED]]
Sent: Tuesday,
6 matches
Mail list logo