Jump to content

follow-up to missing data


niche

Recommended Posts

please see the original topic if you'd like: http://w3schools.invisionzone.com/index.php?showtopic=32056I've written a while loop with a nested if statement. The while loop is designed to skip an item number if it's not in the $_POST array. The problem is the if statement isn't triggering any of the values in the $_POST array which looks like this: array(3) { ["item1"]=> string(1) "1" ["item2"]=> string(1) "2" ["item4"]=> string(1) "4" }. Here's the script:

$counter = 1;$src = "'$new[user]'";while ($counter < $max) {  if (isset($_POST['item$counter'])) {    echo 'here';    $index = 'item' . $counter;    $src = $src . ", '$new[$index]'";  }$counter++;}

I know the if statement isn't working because the "echo 'here';" script isn't being activated. How do I need to change my if statement?ThanksThanks

Link to comment
Share on other sites

Never would have thought to lay it out that way! Thanks wirehopper.Niche

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...