Re: [PHP] evaluating dynamic variable

2003-09-02 Thread CPT John W. Holmes
From: "Stephen Goodman" <[EMAIL PROTECTED]>


> When I run the code you've attached, with $i iterating up to 3, I get
> three 'empty!', even if $resolution1 should be 'not empty!'. It seems
> like the $i in $_POST["resolutions".$i] is not getting parsed into a
> value, and php is looking for a key resolutions$i.
>
> Whoops, I'm an idiot. Resolution singular, not plural. Thanks for the
> help everyone

Does that mean you solved it? Remember that PHP is case sensitive, too.
$_POST['Resolution'] is not the same as $_POST['resolution'].

If you're still having trouble, go back to some basic debugging. Do a
print_r($_POST) so you actually know what $_POST contains, to begin with.

---John Holmes...

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] evaluating dynamic variable

2003-09-02 Thread Stephen Goodman
When I run the code you've attached, with $i iterating up to 3, I get
three 'empty!', even if $resolution1 should be 'not empty!'. It seems
like the $i in $_POST["resolutions".$i] is not getting parsed into a
value, and php is looking for a key resolutions$i.


Whoops, I'm an idiot. Resolution singular, not plural. Thanks for the
help everyone

.
-Original Message-
From: Chris W. Parker [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, September 02, 2003 3:29 PM
To: Stephen Goodman; [EMAIL PROTECTED]
Subject: RE: [PHP] evaluating dynamic variable

Steve Goodman <mailto:[EMAIL PROTECTED]>
on Tuesday, September 02, 2003 12:54 PM said:

> Can someone
> recommend a way to reliably evaluate this variable?

1. (not positive on this point so correct me if I'm wrong) you shouldn't
compare with !==. Instead us !=.

2. What does the following do?

for ($i=1; $i<=$entries; $i++)
{
if(empty($_POST["resolutions".$i]))
{
echo "empty!";
}
else
{
echo "not empty!"
}
}


You might also like to try isset() along with empty().


hth,
Chris.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] evaluating dynamic variable

2003-09-02 Thread Chris W. Parker
Chris W. Parker <>
on Tuesday, September 02, 2003 1:29 PM said:

> 1. (not positive on this point so correct me if I'm wrong) you
> shouldn't compare with !==. Instead us !=.

Ok, turns out I'm wrong on that. I guess I should go look it up!!

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] evaluating dynamic variable

2003-09-02 Thread Chris W. Parker
Steve Goodman 
on Tuesday, September 02, 2003 12:54 PM said:

> Can someone
> recommend a way to reliably evaluate this variable?

1. (not positive on this point so correct me if I'm wrong) you shouldn't
compare with !==. Instead us !=.

2. What does the following do?

for ($i=1; $i<=$entries; $i++)
{
if(empty($_POST["resolutions".$i]))
{
echo "empty!";
}
else
{
echo "not empty!"
}
}


You might also like to try isset() along with empty().


hth,
Chris.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] evaluating dynamic variable

2003-09-02 Thread Matt Matijevich
this worked for me.

";
   }
  }



?>














-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] evaluating dynamic variable

2003-09-02 Thread Jay Blanchard
[snip]
I'm having trouble evaluating a dynamic variable. I want to check if the
variable $_POST["resolutions$i"] is an empty string, as you'll see from
the
code. However, every way I've tried to check the variable so far
(including
empty() and eval()) always returns a null value, even when the variable
should contain a value. I've probably been doing something wrong in my
previous efforts. Can someone recommend a way to reliably evaluate this
variable?

for ($i=1; $i<=$entries; $i++) {
   if($_POST["resolutions$i"] !== ''){
do_something();
   }
  }
[/snip]

Well, I tried this
/*
** submit form (res1.php)
*/







/*
** process (res2.php)
*/



And I had no problems.

HTH!

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] evaluating dynamic variable

2003-09-02 Thread Steve Goodman
Hi,
I'm having trouble evaluating a dynamic variable. I want to check if the
variable $_POST["resolutions$i"] is an empty string, as you'll see from the
code. However, every way I've tried to check the variable so far (including
empty() and eval()) always returns a null value, even when the variable
should contain a value. I've probably been doing something wrong in my
previous efforts. Can someone recommend a way to reliably evaluate this
variable?

for ($i=1; $i<=$entries; $i++) {
   if($_POST["resolutions$i"] !== ''){
do_something();
   }
  }

Thanks.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php