note 36991 added to function.array-keys

From: Date: Wed, 29 Oct 2003 22:14:06 +0000
Subject: note 36991 added to function.array-keys
Groups: php.notes 
Request: Send a blank email to php-notes+get-59502@lists.php.net to get a copy of this message
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> ---- Manual Page -- http://www.php.net/manual/en/function.array-keys.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+36991 Delete -- http://master.php.net/manage/user-notes.php?action=delete+36991&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+36991&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#59502) next »