You are here: Re: "Array to String Conversion" error when constructing a multi-dimensional array « PHP Programming Language « IT news, forums, messages
Re: "Array to String Conversion" error when constructing a multi-dimensional array

Posted by Rik on 01/22/07 21:14

drako wrote:
> I got this working in the end. It seemed that having the following
> variables caused some clash:
>
> $_POST['increment']
> $_SESSION['increment']
>
> once I changed this to $_SESSION['increments'] (notice the plural),
> then it was creating arrays within the session variable as expected,
> and I can now run it through a 'foreach' loop and 'array_multisort' in
> order to process the array data.

[despirately trying to claim the fame]

Well, you're copying the POST to the SESSION somewhere in your code in that
case, as it is not a PHP feature. This works fine:
<?php
session_start();
if(!isset($_POST['submit'])){
$_SESSION['increment'] = 'This is the session value';
}
?>
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<input type="text" name="increment">
<input type="submit" name="submit">
</form>
<pre>
<?php
echo "The SESSION is {$_SESSION['increment']}\n";
echo "The POST is {$_POST['increment']}\n";
?>
</pre>

And upon posting "This is the post value" in correctly displays:
The SESSION is This is the session value
The POST is This is the post value

I'd say my claim you've turned it into a string stands :-)

[/end of sad little claim here]
--
Rik Wasmus

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация