disappearing array?

From: Date: Thu, 20 Sep 2007 18:58:28 +0000
Subject: disappearing array?
Groups: php.general 
Request: Send a blank email to php-general+get-262305@lists.php.net to get a copy of this message
I am not sure what the heck is going with this but here is my problem. I am trying to validate the contents of an array, then determine if the errors are with the array or another form submitted variable. The problem is after the code validates the array and other form variables using an if statement, I then try to determine if the error is in the array but for some reason the contents of the array disappear. Weird. Any help is appreciated. Here is the code: function ValArray( $array ) { echo "<pre>"; print_r( $array ); echo "</pre>"; $val = new ValidateStrings(); $data = 0; if( count( $array ) !== 0 ) { for( $x = 0; $x < count( $array ); $x++ ) { echo "DATA: " . $array[$x][0] . "<br>"; if( $val->ValidateInteger( $array[$x][0] ) === -1 ) {// || ( $val->ValidateParagraph( $array[$x][1] ) === -1 ) || ( $val->ValidateMoney( $array[$x][2] ) === -1 ) || ( $val->ValidateAlphaChar( $array[$x][3] ) === -1 ) || ( $val->ValidateAlphaChar( $array[$x][4] ) === -1 ) ) { $data = -1; } } } echo "RESULTS: " . $data . "<BR>"; return $data; } if( ValArray( $_POST['add_order_items'] ) === -1 ) { $message = "error"; echo "<pre>"; print_r( $_POST['add_order_items'] ); echo "</pre>"; // here is where it is empty or something else if( $fix->ValArray( $_POST['add_order_items'] === -1 ) ) { $errors['add_order_array'] = $erlink; } echo "<pre>"; print_r( $_POST['add_order_items'] ); echo "</pre>"; And the output: Array ( [1] => Array ( [0] => ^&%*&( [1] => ^*&() [2] => ^*&() [3] => ^*&()_ [4] => ^%&*() ) [0] => Array ( [0] => afadsf [1] => adsfasfasdf [2] => asdfasdfasdf [3] => asdfasdfasdf [4] => asdfasdfasdf ) ) DATA: afadsf DATA: ^&%*&( RESULTS: -1 DATA: RESULTS: -1 Array ( [1] => Array ( [0] => ^&%*&( [1] => ^*&() [2] => ^*&() [3] => ^*&()_ [4] => ^%&*() ) [0] => Array ( [0] => afadsf [1] => adsfasfasdf [2] => asdfasdfasdf [3] => asdfasdfasdf [4] => asdfasdfasdf ) )

« previous php.general (#262305) next »