Re: Re: Simple Array question
| From: | Ryan A | Date: | Tue, 29 Jul 2003 23:03:26 +0000 |
| Subject: | Re: Re: Simple Array question | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-157463@lists.php.net to get a copy of this message | ||
Hi,
Thanks for replying.
I tried that and have 2 numbers like so:
<input name="id[sh123]" type="hidden" value="32">
<input name="id[sh1sd]" type="hidden" value="563">
and tried to echo it like so:
<?php
$id=$_POST['id'];
foreach($_POST['id'] AS $row)
echo $row;
?>
Echo of one is <?php echo $row[0]; ?> and echo of two is:<b> <?php echo
$row[1]; ?></b><br><br>
Echo of one is <?php echo $id[0]; ?> and echo of two is:<b> <?php echo
$id[1]; ?></b>
the output i got was:
******************
32563Echo of one is 5 and echo of two is: 6
Echo of one is and echo of two is:
*****************
AS you can see its totally wrong.Any other ideas?
cheers,
-Ryan
> Normally array values start at 0 (zero), but let's say sh1=1 and sh2=2.
then
> you could echo the values out like this: echo "ID 1: $id[1]<br>ID 2:
> $id[2]<br>";
>
> Irvin.
> > Hi,
> > If i am posting something like this from a form:
> > <input type=checkbox name='id[sh1]' value=3>
> > <input type=checkbox name='id[sh2]' value=4>
> >
> > How do i get the value of id[]?
> > eg:
> > I dont want the "sh1" and "sh2", i just want the "3" and
> > "4"
> >
> > The reason i dont wan the sh1 and sh2 is those are dynamic and will be
> > changing, I just need the values (in this case 3 and 4) to do some
> > comparasion and assignment operations
> >
> > Kindly reply.
> >
> > Thank,
> > -Ryan
> >
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>