Date: 10/30/01
- Next message: Bruno Gimenes Pereti: "Re: [PHP-DB] PHP query on "date" field"
- Previous message: Jason: "[PHP-DB] PHP query on "date" field"
- In reply to: * R&zE:: "Re: [PHP-DB] Variables in a loop"
- Next in thread: Bruno Gimenes Pereti: "Re: [PHP-DB] Variables in a loop"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
If you have a string that is the name of an input field, you can do one of
3 things:
Ex:
$sName = "input".$i; //result = "input1"
$sName = "input".$i; //result = "input2"
etc...
1: Variable Variables
$value = $$sName;
2: If you posted the form
$value = $HTTP_POST_VARS[$sName];
3: If you used GET with the form
$value = $HTTP_GET_VARS[$sName];
Regards,
-Jason Garber
IonZoft.com
At 09:10 AM 10/30/2001 +0100, * R&zE: wrote:
><Original message>
>From: LeTortorec, Jean-Louis <JLeTortorec <email protected>>
>Date: Mon, Oct 29, 2001 at 04:03:45PM -0500
>Message-ID: <615315231286D21182E40008C7B1EED23C6E76 <email protected>>
>Subject: [PHP-DB] Variables in a loop
>
> > I'm trying to write a loop to read variables I receive from a form:
> >
> > <form ...>
> > <input name=a1 value=..>
> > <input name=a2 value=..>
> > <input name=a3 value=..>
> > <input name=a4 value=..>
> >
> >
> > I'd like to get something like:
> >
> > for ($i=1; $i<=10; $i++) { $tab[$i]="a".$i ;}
> >
> >
> > The expression "a".$i is actually a string, not a variable. Any idea
> how to
> > "read" the value of that string?
> >
> > Thanks for your help.
> >
> > Jean-Louis
>
></Original message>
>
><Reply>
>
>Why don't you just use an array?
>
><form ...>
><input name="a[]" value="..">
><input name="a[]" value="..">
><input name="a[]" value="..">
><input name="a[]" value="..">
>
></Reply>
>
>--
>
>* R&zE:
>
>
>-- »»»»»»»»»»»»»»»»»»»»»»»»
>-- Renze Munnik
>-- DataLink BV
>--
>-- E: renze <email protected>
>-- W: +31 23 5326162
>-- F: +31 23 5322144
>-- M: +31 6 21811143
>--
>-- Stationsplein 82
>-- 2011 LM HAARLEM
>-- Netherlands
>--
>-- http://www.datalink.nl
>-- ««««««««««««««««««««««««
>
>--
>PHP Database Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: php-db-unsubscribe <email protected>
>For additional commands, e-mail: php-db-help <email protected>
>To contact the list administrators, e-mail: php-list-admin <email protected>
-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-db-unsubscribe <email protected> For additional commands, e-mail: php-db-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: Bruno Gimenes Pereti: "Re: [PHP-DB] PHP query on "date" field"
- Previous message: Jason: "[PHP-DB] PHP query on "date" field"
- In reply to: * R&zE:: "Re: [PHP-DB] Variables in a loop"
- Next in thread: Bruno Gimenes Pereti: "Re: [PHP-DB] Variables in a loop"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

