-2

If I have a form:

 <form action="/page.php" method="POST">
 <input name="length[<?=$ID;?>]['00:12:00']">
 </form>

So, on the BACK end, I clearly have an array, but I need to reference the ID number above, i.e.

 foreach($_POST['length'] AS $p) {

 echo($p['ID']);  
 echo($p['ID']['length_number']);


 }

Is there a way to structure the front end form input data differently so it is easier to comb through on the back end?

CRAIG
  • 977
  • 2
  • 11
  • 25

2 Answers2

0

You could reference it by using a hidden input field to grab the ID.

<input type="hidden" name="id" value="<?php echo $id; ?>" />
Eliel
  • 164
  • 6
0

Try using something like this:

foreach($_POST['length'] AS $id=>$values) {
   echo $id;
   print_r($values);
}

The the above $values will be an array such as array('00:12:00'=>'{value of the input field}')

Shobhit
  • 1
  • 1