RE: [PHP] Variable Scope Problem
| From: | Anthony Martin | Date: | Wed, 06 Dec 2000 00:35:17 +0000 |
| Subject: | RE: [PHP] Variable Scope Problem | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-28793@lists.php.net to get a copy of this message | ||
I assume you mean that your clickable image is an "HREF". You are limited
to around 7k of space in a URL. I'm sure some browsers can do more or less.
If you have to use GET using more than 7k, you have a problem.
Here are the three ways I can perform the operation you are talking about.
---------------------------BEGIN-----------------------------
<?
if ( $d ) list ( $b, $trash ) = each ( $d ) ;
if ( $b ) {
$c = unserialize ( $b ) ;
echo implode ( ', ', $c ) ;
}
for ( $i = 0 ; $i < 100 ; $i++ ) {
$a[$i] = $i ;
}
$b = serialize ( $a ) ;
?>
<BR>
Method 1:<BR><BR>
<A href="<?=$PHP_SELF?>?b=<?=$b?>"><IMG
src="about:logo"></A>
<HR>
Method 2:
<FORM action="<?=$PHP_SELF?>" method="POST">
<INPUT type="hidden" name="b" value="">
</FORM>
<A href="#" onClick="with ( document.forms[0] ) { elements[0].value =
'<?=$b?>' ; submit ( ) ; return false ; }"><IMG
src="about:logo"></A>
<HR>
Method 3:
<FORM action="<?=$PHP_SELF?>" method="POST">
<INPUT type="image" src="about:logo" name="d[<?=$b?>]">
</FORM>
<HR>
---------------------END---------------------
If you adjust the for-loop condition, you can see that the first version
starts to break past 120. The other two can take a much larger number.
Anthony
-----Original Message-----
From: Kevin Leavell [mailto:k@bigsky.net]
Sent: Tuesday, December 05, 2000 4:01 PM
To: PHP LIST
Subject: [PHP] Variable Scope Problem
I have a clickable image which, when clicked, submits a variable through the
url back to the same page...standard stuff.
Anyway, I've got an array that I need to get over to the other side as well.
I'm not using a form so I can't use hidden fields. The array is too large
to url encode it.
Any pointers would be muchly appreciated.
Kevin
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net