There are essentially 2 ways:
1. All POSTed data is present in the $_POST superglobal array. So you
could just loop over that, ignore the fields you already knew were there,
and the data remaining is then essentially the data you seek. The keys in
the $_POST array are the fieldnames you are looking for.

2. There's a special trick in PHP, when you name a field "name[]" in HTML
and then POST it to a PHP script, it will turn into an array field. So
<input name="a[]" value="1">  <input name="a[]" value="2">  will then end up
$_POST = [
    'a' =>  [
       0 =>  '1',
       1 =>  '2'

If you had not added the square-brackets, you would have:
<input name="a" value="1">  <input name="a" value="2">  ending up in:
$_POST = [
    'a' =>  '2'
Thus not ever seeing the value '1'.

checkbox field name="input_1" value="y"
checkbox field name="input_2" value="y"
field name input_n

//checkboxes return on submit only if ticked
$query="SELECT id FROM table WHERE etc";
$result=mysql_db_query($db, $query,$connection);
while($row=mysql_fetch_row($result)) {
        //dynamic variable
        //if form uses textfield that returns on submit
        //if checkbox that only returns if ticked
                echo "checked 1";

PHP General Mailing List (
To unsubscribe, visit:

Reply via email to