personally, that's what i would do.
dealing with arrays usually makes the code a
lot cleaner and easier to follow than using
awkward constructs like ${$C_Last}{$i}
and besides, if you ever wanted to expand your
code, you could easily pass the entire array
to a function like so: children( $C_La
how about :
if ((isset($number ))&&($number <= $max)){
while ($number > 0;$number -- ) {
echo 'Last Name';}
}
if you're not crazy about having the fields labled in reverse order you
could push to an array and then arsort the array.
Ma
you should make the form names
C_Last_Name1, C_Last_Name2, C_Last_Name3
and then have a hidden variable saying the maximum, then make a small
routine on the receiving page which loops 1 to the max and uses array_push
to make an array of children names. Check for empty() so that way is
someone f
I think you want
if (!(${"C_Last_Name$y"})) {
or
if (!(${"C_Last_Name".$y})) {
-Original Message-
From: Jeff Oien [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, July 11, 2001 10:22 AM
To: PHP
Subject: RE: [PHP] Variable Next To Variable?
I like this idea but it
I like this idea but it's giving me a parse error on this code:
if (!{$C_Last_Name}{$y})
I'm looking at the other ideas also.
Jeff Oien
> > if (!$C_Last_Name$y) {
> > The form submitting information to this code has field name like
> > C_Last_Name1 C_Last_Name2 depending on how many Child
You could use an array:
like
Way better this way
and you oculd do:
$y=1;
while($y
> Sorry if this has been brought up 100 times.
>
> I want to do this:
>
> $y = "1";
>
> while ($y <= "$Number_Children") {
> if (!$C_Last_Name$y) {
> error stuff;
> $
you should change the form field names to
$Children_Last[1], $Children_Last[2]
instead of hardcoding $Children_Last1
to make iteration thru the form easier
and handling of the data easier...
you can handle it all like this:
$Number_Children = 5;
$i = $Number_Children;
while ($i--) {
i
> if (!$C_Last_Name$y) {
> The form submitting information to this code has field name like
> C_Last_Name1 C_Last_Name2 depending on how many Children
> are signing up for something. So I need $y to represent the number.
You want this:
if (!{$C_Last_Name}{$y}) {
The {} surrounding the var
8 matches
Mail list logo