sharp.mac Posted May 30, 2010 Share Posted May 30, 2010 Ok, so I got a php loop going on that creates several input fields. What I am using as the naming sequence is as follows. <input name="clientPickup<?php echo $row_count; ?>" type="text" id="clientPickup<?php echo $row_count; ?>" style="width:350px;"/> on the submitted page the php catch looks like foreach($_POST as $k=>$v) $$k=$v; Now I understand that I am now allowed to call my variables as simply as $clientPickup1, $clientPickup20, $clientPickup90, etc.... This is cool, but I never know what the $clientPickupNUMBER is! Sometimes its... clientPickup5, clientPickup12, clientPickup34, clientPickup98 Always different to say the least. How can I run a loop that strips out all NULL values and rebuilds a new array that I can structure? I've looked into array_filter, empty(), isset() and I simply do not understand what I am doing wrong. Thank you for any advice you may have. Quote Link to comment https://forums.phpfreaks.com/topic/203331-_post-array-remove-null-values-from-list/ Share on other sites More sharing options...
ignace Posted May 30, 2010 Share Posted May 30, 2010 <input type="text" name="clientPickup[<?php print $row_count; ?>]" id="clientPickup<?php print $row_count; ?>" style="width: 350px;" /> foreach ($_POST['clientPickup'] as $row_count => $value) { Quote Link to comment https://forums.phpfreaks.com/topic/203331-_post-array-remove-null-values-from-list/#findComment-1065292 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.