yeah, it definitely works with text fields too. You can also do something
like:

<input type="text" name="poly[<?=$i;?>]">

where $i will then be the key of the resulting array $poly. it doesn't seem
necessary in this case, since the numbers will probably be consecutive, but
if you wanted an associative array for some reason this can be useful.


Corey Eiseman
Infinite Orange Incorporated
http://infiniteorange.com/






"Rick Emery" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> name each field with an array name.  I know the following works with
> checkboxes; try it with text fields:
>
> <input type=text name=poly[] value="">
> <input type=text name=poly[] value="">
> <input type=text name=poly[] value="">
> <input type=text name=poly[] value="">
>
>
> then, in your php script called from the form, you'll access the
polynomials
> using poly[0], poly[1], poly[2], poly[3], etc.
> You know how many fields were created, because you created them; so you
> could pass the number of created fields in a HIDDEN value ($NoPols) from
the
> form.  As you examine each field, you'll determine if it's empty or not.
>
> for( $idx=0; $idx<$NoPols; $idx++ )
> {
> if( strcmp( "", $poly[$idx] )
> {
> ... do something with field ...
> }
> }
>
> -----Original Message-----
> From: brendan conroy [mailto:[EMAIL PROTECTED]]
> Sent: Monday, February 18, 2002 3:27 PM
> To: [EMAIL PROTECTED]
> Subject: RE: [PHP] Novice Question
>
>
> I wish to create multiple input fields on a single form, I think(sorry
> ..could you advise?)
>
> I'd like a page that has multiple input fields, but I dont know how to
> access the individual inputs.
>
> Say the user wanted to enter three inputs(polynommials in this case)
> so they get a page with three input boxes,
>
> Enter polynommial here:
>
> Enter polynommial here:
>
> Enter polynommial here:
>
>
> How would I dynammicaly create the input boxes and name the inputs. Thanks
> for your time on this, I sorry I didnt explain this clearer in the first
> place,
>
>
> Thanks,
>
>
> Bren
>
>
>
> >From: Rick Emery <[EMAIL PROTECTED]>
> >To: 'brendan conroy' <[EMAIL PROTECTED]>,
> >[EMAIL PROTECTED]
> >Subject: RE: [PHP] Novice Question
> >Date: Mon, 18 Feb 2002 14:54:09 -0600
> >
> >Do you wish to create multiple forms or multiple input fields on a single
> >form?
> >
> >-----Original Message-----
> >From: brendan conroy [mailto:[EMAIL PROTECTED]]
> >Sent: Monday, February 18, 2002 2:48 PM
> >To: [EMAIL PROTECTED]
> >Subject: [PHP] Novice Question
> >
> >
> >Hi thanks for reading this.
> >
> >This problem is difficult to get across, this is what happens:
> >
> >A) On a html page I ask users how many inputs they wish to enter, say 3.
> >The
> >
> >3 is stored as a variable called $NoPols.
> >
> >B) Then in the code below, a loop creates $NoPols (3) forms to take the
> >users inputs.
> >
> >The problem is that the same name($Yourpol) is used in each of the
created
> >forms, and i dont know how to get around this problem.
> >
> >I would like to know if it is possible to create a page which has a
number
> >of forms, the number of which is decided by the user(on a start page), so
> >the user can submit as many inputs as they want from one page.
> >
> >
> >Sorry if I've wasted your time,
> >
> >I'd be very grateful for any assisstance with this problem,
> >
> >thanks a million,
> >
> >
> >
> >
> >Brendan
> >
> >
> >
> >
> >
> >
> >
> ><html>
> ><head>
> ><title>npage.php</title>
> >
> ></head>
> >
> ><body bgcolor="#FFFFFF" text="#000000">
> >
> ><p>
> ><?php $NoPols; ?>
> ><?php
> >for($i=1 ;$i<= $NoPols ; $i++)
> >{
> >?>
> ><form action="ppage.php" method=post>
> >enter polynomial <? echo "$i";?> here:<input type="text" name="Yourpol">
> ><br>
> ></br>
> ><?
> >}
> >?>
> ><input type="submit" name="submit" value="Submit Pols!">
> >
> >
> >
> ></body>
> ></html>
> >
> >_________________________________________________________________
> >Send and receive Hotmail on your mobile device: http://mobile.msn.com
> >
> >
> >--
> >PHP General Mailing List (http://www.php.net/)
> >To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >--
> >PHP General Mailing List (http://www.php.net/)
> >To unsubscribe, visit: http://www.php.net/unsub.php
> >
>
>
> _________________________________________________________________
> Join the world's largest e-mail service with MSN Hotmail.
> http://www.hotmail.com



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to