"John Kelly" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > "John Kelly" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > Hi, I have a form using the post method that outputs a dynamic number of > > fields each time with the same name but different values - this is > required. > > For example ... > > > > filename[] > > filename[] > > filename[] > > filename[] > > > > On the next page I try to access the array using ... > > > > for($i=0; $i<count($filename); $i++) { > > $value = $filename[$i]; > > do something with $value ... > > } > > > > but $filename[0], $filename[1], $filename[2], etc each contain one letter > > from the word "Array" if there were say five items in the array!? What am > I > > doing wrong and/or how do I get the actual values? > > > > > > Update ... when I remove the following code which comes before the code > above it works. Anyone know why it does not work when the following code is > in there and/or how I can modify the following code so I can keep it in and > still get the array to work. I have register globals off and want to protect > the data going into a database which is what I thought the purpose of the > following code was for. > > foreach($HTTP_POST_VARS as $k=>$v){ > if (get_magic_quotes_gpc()){ > $HTTP_POST_VARS[$k] = stripslashes($v); > $HTTP_POST_VARS[$k] = mysql_escape_string($HTTP_POST_VARS[$k]); > } else { > $HTTP_POST_VARS[$k] = mysql_escape_string($v); > } > eval( "\$$k = \"$HTTP_POST_VARS[$k]\";" ); > } > > >
Seems the mysql_escape_string was messing up the array. When I evaluated the arrays before the above code and then used mysql_escape_string on each of the arrays values in the "for" code it worked fine. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php