Bas, et al --
...and then Bas Jobsen said...
%
% print "<a href=\"/myscript.php?keylist=".str_replace("
% ","+",implode("+",$keylist))."\">link</a>" ;I tried this and my link the looks like Click <a href="testme.php?a+b b b+c">here</a> to go round again<br> (that is, not only have I not taken care of the spaces but I now also lose the fact that these are part of $keylist). The entire little script is attached. You can see various means of printing the array. I *have* found that I can construct a link like testme.php?keylist[]=a&keylist[]=b& ... so that takes care of walking the array but now I need to protect myself from the spaces. I've looked at htmlentities() but it doesn't seem to convert spaces... Thanks again & HAND :-D -- David T-G * It's easier to fight for one's principles (play) [EMAIL PROTECTED] * than to live up to them. -- fortune cookie (work) [EMAIL PROTECTED] http://www.justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg!
<html>
<head>
<title>
Test page
</title>
</head>
<body>
<?php
if ( ! $keylist )
{
print "No \$keylist; starting from scratch<br>\n" ;
# $keylist = array('a','b','c') ; # works (of course)
# $keylist = array('a','b%20b%20b','c') ; # works; is 'b b b' on 2nd pass
$keylist = array('a','b b b','c') ; # doesn't work; spaces are bad
print "\$keylist is $keylist<br>\n" ;
foreach ($keylist as $k)
{ print "\$k is .$k.<br>\n" ; }
# print "Click <a href=\"/testme.php?keylist=$keylist\">here</a> to go round
again<br>\n" ;
print "Click <a href=\"testme.php?" ;
# foreach ( $keylist as $k ) { print "keylist[]=$k&" ; }
print str_replace("","+",implode("+",$keylist)) ;
print "\">here</a> to go round again<br>\n" ;
}
else
{
print "I have a \$keylist. It is .$keylist.<br>\n" ;
foreach ( $keylist as $k ) { print "\$k is .$k.<br>\n" ; }
}
print "<br>\n<br>\n" ;
?>
</body>
</html>
msg74958/pgp00000.pgp
Description: PGP signature

