note 36991 deleted from function.array-keys by aidan

From: Date: Sun, 26 Sep 2004 00:48:52 +0000
Subject: note 36991 deleted from function.array-keys by aidan
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-77353@lists.php.net to get a copy of this message
Note Submitter: festuc at nospamplease dot amena dot com ---- If you want pass arround pages yours arrays, you can try these: <?php function hidden($name,$valor){echo "<INPUT TYPE=\"hidden\" NAME=\"$name\" VALUE=\"$valor\">\n";} function hiddenarray($name,$valor){ $noms=array_keys($valor); $i=0; while($i<sizeof($noms)){ if(is_array($valor[$noms[$i]])){ hiddenarray($name.'['.$noms[$i].']',$valor[$noms[$i]]); } else { hidden($name.'['.$noms[$i].']',$valor[$noms[$i]]); } $i++; } } echo'<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <head> <title> :: Playing whith hiddenarray:: </title> </head> <body>'; $m[1]=1; $m[2][1]=2; $m[2][2]=3; $m[3][1][1]=4; $m[res][foo][nothing]="festuc're catalan, not taliban :D"; hiddenarray("m",$m); echo '</body>'; ?> these file generate this html: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <head> <title> :: Playing whith hiddenarray:: </title> </head> <body><INPUT TYPE="hidden" NAME="m[1]" VALUE="1"> <INPUT TYPE="hidden" NAME="m[2][1]" VALUE="2"> <INPUT TYPE="hidden" NAME="m[2][2]" VALUE="3"> <INPUT TYPE="hidden" NAME="m[3][1][1]" VALUE="4"> <INPUT TYPE="hidden" NAME="m[res][foo][nothing]" VALUE="festuc're catalan, not taliban :D"> </body>

« previous php.notes (#77353) next »