Jump to content

_POST array & remove NULL values from list


sharp.mac

Recommended Posts

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.

 

Archived

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

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.