[CLUG] TECH/PHP question
Fixer
fixer at vigilante.net
Tue Oct 23 21:51:19 IST 2001
I think I realized that just after I hit send...if I explicitely name the
array key, it will hold it's position, so to speak...
now, how would I set the name field in an html form that is within a for loop?
<?
$configtext = file ($configfile);
for ($t=0;$t<count($configtext);$t++) {
list($cfile,$ccaption)=explode("}",$configtext[$t]) ;
?>
<input type="text" name="<? =$t; ?>[caption]" value="<? =$ccaption; ?>">
then I just walk thru arrays 1 thru count($configtext) and do what I will
with them...
look right?
or should the name be
<input type="text" name="array[<? =$t; ?>][caption]" value="<? =$ccaption; ?>">
At 21:36 23/10/2001 +0100, ad at m.beecher.net wrote:
> > For example, if there is no caption text for image 5, the image array
> > will only have 9 items...of if I flipped the array, I would end up with
> > the delete value in the caption slot.
> >
>Why would you only have 9 items in the image array (and surely you mean the
>caption array)? If you number them specifically in the form -
>name="image[$i]" - the empty elements will be just that, empty elements. You
>can still associate them by number.
>
>adam
--
fix.er \'fik-s*r\ n : one that fixes : as : one that intervenes to
enable a person to circumvent the law or obtain a political
favor : one that adjusts matters or disputes by negotiation
More information about the Cork
mailing list