PDA

View Full Version : URGENT!!! HTML form/PHP problem...



ya3
March 26th, 2007, 11:07 PM
Okay, so basically, I have a whole heap of checkboxes. The name/id for each checkbox is just a random number.

I have them set up in a form, which submits the data to a PHP file.

In the PHP file, I need it to take the data from every single checkbox and do something with it... So I need some kind of loop like this:

Code:

// let '$checkboxnumber' be the name/id of the each checkbox
// and '$checkboxvalue' be the value of each one

LOOP:
echo "$checkboxnumber - $checkboxvalue"

Haha.. ok... very primitive... But I basically need a loop to go through every single checkbox sent to the PHP page (via POST) and do stuff to it (in this example, just ECHO. but i'll be entering them into a MySQL DB).

HELP??

ya3
March 26th, 2007, 11:26 PM
Ok, cancel that. I got it.


<?php
foreach ($_POST as $key => $value) {
if ($key != "Submit") {
echo "$key $value<br>";
}
}
?>


:P