Re: passing an array in a link

From: Date: Mon, 12 Aug 2002 02:12:21 +0000
Subject: Re: passing an array in a link
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-112082@lists.php.net to get a copy of this message
Ok, I don't know if you already solved this, but you might want to do something like $SerKeylist=rawurlencode(serialize($keylist)); print "<a href=\"/myscript.php?SerKeylist=$SerKeylist\">link</a>"; on the source end and $keylist=unserialize($_GET["SerKeylist"]); at the destination. This of course will build quite an URL for large arrays, so you might consider using a bit of JavaScript and a form at the source end in order to use POST instead of GET if needed. HTH Bogdan David T-G wrote:
Hi, all -- I collect field keys in an array that looks like $keylist = array('comment','job','spaced out key name','foo',...) ; and would like to pass the array to myself in a call like print "<a href=\"/myscript.php?keylist=$keylist\">link</a>" ; but when it's actually run it of course says ...keylist=Array... which is quite bad. I'd use a simple scalar $keylist = "comment job spaced out key name foo ..." ; but, of course, those darned fields which have spaces embedded in the names will really mess that up. How can I pass myself an array -- and recognize it on the receiving end? TIA & HAND :-D


« previous php.general (#112082) next »