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.

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.