Importing checkboxes

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
cczernia
Forum Newbie
Posts: 20
Joined: Tue May 16, 2006 2:00 pm
Location: San Diego, CA

Importing checkboxes

Post by cczernia »

I have a form that dynamically generates checkboxes. Right now the name of each checkbox is different. Does anyone know how I can import the names of the form into php if they are checked. I am mostly familiar with $_GET and $_POST but I can't use those if I don't know the names of the input fields.

Thanks in advance.
User avatar
jaoudestudios
DevNet Resident
Posts: 1483
Joined: Wed Jun 18, 2008 8:32 am
Location: Surrey

Re: Importing checkboxes

Post by jaoudestudios »

Use a loop to grab the auto generated post names and post values.

Code: Select all

 
<?php
foeach ($_POST as $k=>$v) {
 $$post = $k;
 $post = $v;
}
?>
 
Post Reply