Re: array varible problems
| From: | edwardspl at ita dot org dot mo | Date: | Sun, 14 Aug 2005 11:02:14 +0000 |
| Subject: | Re: array varible problems | ||
| References: | 1 2 3 4 5 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-220596@lists.php.net to get a copy of this message | ||
Hello Jasper,
Does your means :
I need to rewite the source / result page as the following ?
Result page:
<?
for($i=0;$i<4;$i++)
{
$f.$i=$_GET['$f.$i'];
}
?>
<table>
<tr>
<td><? echo $f0[0];?></td>
<td><? echo $f1[0];?></td>
<td><? echo $f2[0];?></td>
<td><? echo $f3[0];?></td>
</tr>
<tr>
<td><? echo $f0[1];?></td>
<td><? echo $f1[1];?></td>
<td><? echo $f2[1];?></td>
<td><? echo $f3[1];?></td>
</tr>
<tr>
<td><? echo $f0[2];?></td>
<td><? echo $f1[2];?></td>
<td><? echo $f2[2];?></td>
<td><? echo $f3[2];?></td>
</tr>
</table>
Source page:
<table>
<tr>
for($i=0;$i<4;$i++)
{
<td><input type=checkbox name='f<? echo $i;?>[]'
value='1'></td>
}
</tr>
</table>
Thank for your help !
Edward.
Jasper Bryant-Greene wrote:
> edwardspl@ita.org.mo wrote:
> > Sorry, I don't quit understanding the site
> > http://www.php.net/for...
> > So, would you mind to give me a example about it ?
>
> for($i=0; $i<3; $i++) {
> print($i);
> }
>
> will print:
>
> 0
> 1
> 2
>
> Basically in any expression like the following:
> for(expr1; expr2; expr3) {
> // some code
> }
>
> expr1 is evaluated first.
> then for as long as expr2 is true, "some code" followed by expr3 will be
> evaluated over and over.
>
> So the example at the start of my message initially sets $i to 0, then
> repeats the code, adding 1 to $i each time, for as long as $i is less
> than 3.
>
> Jasper
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php