Re: serialized arrays

From: Date: Fri, 10 Oct 2003 13:51:31 +0000
Subject: Re: serialized arrays
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-165743@lists.php.net to get a copy of this message
On Fri, 2003-10-10 at 07:41, Donaldson Sgt Michael J wrote: > $s_array1 = serialize($results); > > echo "<img src= \"gd_graph.php?h_array=urlencode($s_array1) \" >"; > > What's the problem with this code? I am trying to pass an array to create > graph but instead of the pic i get this in my browser. Probably do to bad > HTML syntax. Can I urlencode in a get or does it have to be a hidden > variable in a post? > > <img src= > > "gd_graph.php?h_array=urlencode(a:2:{s:7:"PROGRAM";a:2:{i:0;s:6:"LBIVII";i:1 > > ;s:9:"web_count";}s:3:"NUM";a:2:{i:0;s:2:"69";i:1;s:2:"91";}}) > " > You need to either move the urlencode function outside of the quotes echo "<img src=\"gd_graph.php?harray=",urlencode($s_array1),"\">"; Or encode it first: $s_array1_encoded = urlencode($s_array1); echo "<img src=\"gd_graph.php?harray=$s_array1_encoded\">"; I think the second is easier to understand. - Brad

« previous php.general (#165743) next »