Thank you, Dale. An improvement -:)
I wonder if there is a hint there?
Have tried using the square brackets, although it is
not working as yet, the warning message no longer
appears and the code:
$row = $_POST['row'];
foreach ($row as $BOOK => $VALUE)
{
echo 'BOOK: ' . $BOOK . ':' . $VALUE . '<br>';
}
produces this:
BOOK: 0:Array
For some reason, it is treating the $value as another
array !!?
Any hints?
--- dalemed <[EMAIL PROTECTED]> wrote:
---------------------------------
Dave,
You might want to try putting brackets after the array
name in your
input statement like this:
<input type='hidden' name='row[]' value=$row>
By placing [] after the variable name, you tell PHP to
treat it as an
array instead of as a scalar.
Dale
--- In [email protected], David Halliday
<[EMAIL PROTECTED]> wrote:
>
> Thanks.
> var_dump ($_REQUEST) displayed the word 'Array'.
>
> I think there is a basic problem with passing array
> variables via forms. Look have even tried a simple
to
> pass a small array variable just to test the
> principle, test like this one:-
>
>
> # p1.php
> <?
> $row = array
> (
> "BOOK1" => "PHP",
> "BOOK2" => "JAVA",
> );
> ?>
> <html><body>
> <form method='POST' action='p2.php'>
> <input type='hidden' name='row' value=$row>
> <input type='submit' value='Submit' name='submit'>
> </form>
> </body></html>
>
>
> #p2.php
>
> <?
> $row = $_POST['row'];
> foreach ($row as $BOOK => $VALUE)
> {
> echo $BOOK . ':' . $VALUE;
> }
> ?>
>
> and Im still getting the Warning: invalid arguement
> etc..
>
> also:
> echo $row; // produced 'Array'
>
> echo $row[0]; // produced 'A'
> echo $row [1]; // produced 'r'
>
> and so on..
>
> It baffles me really .. this is now elementary PHP
not
> working as expected!!!
>
___________________________________________________________
To help you stay safe and secure online, we've developed the all new Yahoo!
Security Centre. http://uk.security.yahoo.com
The php_mysql group is dedicated to learn more about the PHP/MySQL web database
possibilities through group learning.
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/php_mysql/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/