NYCPHP Meetup

NYPHP.org

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

LS lss1 at netzero.net
Thu Mar 6 16:37:40 EST 2003


hi,ed;
I tried the code you sent to me and it didn't work. I can't find anywhere
the syntax for passing dynamic array from  from one form to another? the
problem is in the program 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>
<?
$counter=1;
   foreach ( $_GET["Child"] as $c ) {
echo "Child #". $counter++ ." is $c ";
   }
?>
<BR>
<BR>
</BODY>
</HTML>
----- Original Message -----
From: "Nunez, Eddy" <enunez at tiaa-cref.org>
To: "NYPHP Talk" <talk at nyphp.org>
Sent: Tuesday, March 04, 2003 5:07 PM
Subject: RE: [nycphp-talk] how to pass the dynamic array indexes from one f
orm to another in PHP 4.2


>
> 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