Re: passing an array in a link
| From: | B.C. Lance | Date: | Sun, 11 Aug 2002 14:05:06 +0000 |
| Subject: | Re: passing an array in a link | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-112019@lists.php.net to get a copy of this message | ||
you could try this:
transmitting end:
<?php
foreach ($keylist as $key => $value) {
$searchArg .= "keylist[]=".htmlentities($value)."&";
}
?>
<a href="myphp.php?<?php echo $searchArg?>">array from search argument</a>
receiving end:
foreach($_GET["keylist"] as $key => $value) {
echo "{$value}<br>";
}
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