NYCPHP Meetup

NYPHP.org

[nycphp-talk] how to pass the dynamic array indexes from one f orm to another in PHP 4.2

Rolan rolan at omnistep.com
Tue Mar 4 17:18:56 EST 2003


Hey, are you Eddy Nunez from NJIT?

Solving the guys' problem:

$Child is type Array.
To see the data, here is an example to use (as dynamic2.php):

<?
foreach ($_GET['Child'] as $name) {
        print "$name<br>";
}
?>

You should really use a POST instead of a GET for dynamic.php.
With lots of children, the url could get really messy.

~Rolan



Nunez, Eddy wrote:

>Would help if you can tell us what you're trying to do in dynamic2.
>If you're trying to just loop through the children:
>
><html>
><body>
><? $counter=1;
>   foreach ( $Child as $c ) {
>	echo "Child #". $counter++ ." is $c <br>";
>   }
>?>
></body></html>
>
>-Ed
>
>-----Original Message-----
>From: LS [mailto:lss1 at netzero.net]
>Sent: Tuesday, March 04, 2003 4:16 PM
>To: NYPHP Talk
>Subject: [nycphp-talk] how to pass the dynamic array indexes from one
>form to another in PHP 4.2
>
>
>hi;
>I have a problem.I don't know what to write in my program dynamic2.php. The
>program dynamic.php passes array to program dynamic2.php. What code should
>be written in dynamic2.php ?
>thnks
>Leo
>attached codes for both programs
>
>code for dynamic.php:
><HTML>
><HEAD></HEAD>
><BODY>
><FORM METHOD=GET ACTION="dynamic2.php">
><?php
>for ($Counter=0; $Counter<$_POST['Number']; $Counter++)
>{
>   $Offset = $Counter+1;
>   echo "<BR><BR>Please enter the name of child number $Offset<BR>";
>   echo "<INPUT NAME=Child[] TYPE=TEXT>";
>}
>if ($Counter==0) echo"Press the button to move on";
>?>
><BR>
><BR>
><INPUT TYPE=SUBMIT>
></FORM>
></BODY>
></HTML>
>
>--code for dynamic2.php:
><HTML>
><HEAD></HEAD>
><BODY>
><?php
>$Count=0;
>echo "yoe children names are :";
>do
>; $Counter++)
>{
>      echo "<BR><BR>$_GET['Number']";//?
>   echo "<INPUT NAME=Child[] TYPE=TEXT>";
>}
>if ($Counter==0) echo"Press the button to move on";
>?>
><BR>
><BR>
><INPUT TYPE=SUBMIT>
></FORM>
></BODY>
></HTML>
>
>
>
>
>
>
>
>
>**********************************************************************
>This message, including any attachments, contains confidential information intended for a specific individual and purpose, and is protected by law.  If you are not the intended recipient, please contact sender immediately by reply e-mail and destroy all copies.  You are hereby notified that any disclosure, copying, or distribution of this message, or the taking of any action based on it, is strictly prohibited.
>TIAA-CREF
>**********************************************************************
>
>
>--- Unsubscribe at http://nyphp.org/list/ ---
>
>
>
>  
>




More information about the talk mailing list