Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Apr 27th, 2012  |  syntax: None  |  size: 0.50 KB  |  hits: 16  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. How to get vars out of a looped html form?
  2. for($i=0;$i<10;$i++){
  3.   echo '<input type="text" name="field'.$i.'">';
  4. }
  5.        
  6. foreach ($_POST['field'] as $key => $value)
  7. {
  8.  
  9. }
  10.        
  11. for($i=0;$i<$_POST["count"];$i++) {
  12.   $var = $_GET["field".$i];
  13.   //do something
  14. }
  15.        
  16. <input type="text" name="field[0]">
  17.        
  18. $a1 = "What";
  19. $a2 = " are";
  20. $a3 = " you";
  21. $a4 = " doing?";
  22. for($i=1;$i<=4;$i++){
  23.   $txt .= ${"a".$i};
  24.   echo $txt;
  25. }
  26.        
  27. echo '<input type="text" name="field['.$i.']">';
  28.        
  29. $fields = $_POST['field'];