Question : How send an array by url with php???????

Hi

I would like to know how send an array using php to another page, and how to read that array in the destination page

I know that the first step is the use of serialize function and in the destination file to use the unserialize function

When I use  the functions "stringtoarray" and "array_envia" in the same page everything works fine.

I would like to use array_envia in the page that will send the array and stringtoarray in the page that will recibe the array but I dont know how to send the array to one page to the another.

1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
<?

// I use this function to serialize the array
function array_envia($array) {

    $tmp = serialize($array);
    $tmp = urlencode($tmp);

    return $tmp;
}

$array=array("algo","nose","otracosa");
$array=array_envia($array);

?>
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
<?

// I USE THIS CODE TO UNSERIALIZE THE ARRAY
function stringToArray($array)
{
    $tmp = stripslashes($array);
    $tmp = urldecode($tmp);
    $tmp = unserialize($tmp);
 
    return $tmp;
}


$array = stringToArray($_POST['txt_array']);
echo $array['0'];
?>

Answer : How send an array by url with php???????

You can't replace the err object, but you can accomplish what you want to do... you just have to include error handling in every subroutine....

Public Sub SampleCode
  On Error Goto CatchError
  'Your subrotine code here
  Exit Sub
CatchError:
  Err.Raise YourErrorNumber, YourDescription
End Sub

Random Solutions  
 
programming4us programming4us