Jump to content

wkilc

Members
  • Posts

    123
  • Joined

  • Last visited

Everything posted by wkilc

  1. Got it! I had to initialize $XXX = 1 outside the loop. Thank you.
  2. Hi, I am trying to modify some code to add a simple number increment to my results. There are tutorials galore, but the problem is the way the original code is set-up this way: { $XXX = 1; $op1 .= '<table>'; $op1 .= '<tr><td><input type="text" name="School'.$XXX.'" /></td> <td><input type="text" name="Student'.$XXX.'" /></td> <td><input type="text" name="Class'.$XXX.'" /></td> </tr>'; $XXX++; } $op1 .= '</table>'; } <?= $op1; ?> This is the result: <table> <tr><td><input type="text" name=School1"></td> <td><input type="text" name=Student1"></td> <td><input type="text" name=Class1"></td> </tr> <tr><td><input type="text" name=School1"></td> <td><input type="text" name=Student1"></td> <td><input type="text" name=Class1"></td> </tr> <tr><td><input type="text" name=School1"></td> <td><input type="text" name=Student1"></td> <td><input type="text" name=Class1"></td> </tr> </table> I tried: <td><input type="text" name="School'.$XXX++.'" /> but this returns: <table> <tr><td><input type="text" name=School1"></td> <td><input type="text" name=Student2"></td> <td><input type="text" name=Class3"></td> </tr> <tr><td><input type="text" name=School1"></td> <td><input type="text" name=Student2"></td> <td><input type="text" name=Class3"></td> </tr> <tr><td><input type="text" name=School1"></td> <td><input type="text" name=Student2"></td> <td><input type="text" name=Class3"></td> </tr> </table> I am looking for: <table> <tr><td><input type="text" name=School1"></td> <td><input type="text" name=Student1"></td> <td><input type="text" name=Class1"></td> </tr> <tr><td><input type="text" name=School2"></td> <td><input type="text" name=Student2"></td> <td><input type="text" name=Class2"></td> </tr> <tr><td><input type="text" name=School3"></td> <td><input type="text" name=Student3"></td> <td><input type="text" name=Class3"></td> </tr> </table> Apologies if I am not explaining this correctly or if I did not post enough info. Thanks in advance.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.