[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)
*/

<form action="res2.php" method="POST">
<input type="text" name="resolution1">
<input type="text" name="resolution2">
<input type="submit">
</form>

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

<?php
$entries = count($_POST);
for ($i=1; $i<=$entries; $i++) {
   if($_POST["resolutions$i"] !== ''){
        print($_POST["resolution$i"]);
   }
}
?>

And I had no problems.

HTH!

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

Reply via email to