On Wed, Mar 18, 2009 at 12:12:54PM -0700, revDAVE wrote: > Using a repeating region of a query, I want to generate a 'form on the fly' > > So for each repeat - I have an extra form input.... > > Each input name = thisline<?php echo $cnt; ?> > > So it will make names like: > > thisline1 > thisline2 > thisline3 > Etc. > > For the form fields > > ------------------------- > > > $cnt = 1; > <form action="form1.php" method="post" name="test1"> > > Repeat..... > > <input name="go<?php echo $cnt; ?>" type="text" value="" size="5" > maxlength="5" /> > > <?php $cnt++; ?> > > Repeat.................. > > ------------------------------------ > > Q: how do I code the POST line to READ this when processing this form? > > like: > > $cnt = 1; > > <?php echo $_POST['thisline$cnt']; ?> ???? Doesn't work...? This won't work because you've got the expression in single quotes. In order for the $cnt to be evaluated, you have to double-quote it. > <?php echo $_POST['thisline'].$cnt; ?>???? Doesn't work...? This *should* work, except... what is $_POST['thisline']? > > Not this either... > $this = 'thisline'.$cnt; > echo $_POST['$this']; > > > $cnt++ > > Q: ANY Ideas? > If this form is re-entrant (displays 4 lines, user hits "Done" and it displays 5 lines, etc.), then you're going to have to save the $cnt value in the $_POST array. Then you do something like: <?php for ($i = 0; $i < $_POST['cnt']; $i++): ?> <input type="text" size="5" name="thisline<?php echo $i; ?>" value="<?php echo $_POST["thisline$i"; ?>"/> <?php endfor; ?> <?php $cnt = $_POST['cnt']++; ?> <input type="text" size="5" name="thisline$cnt"/> <input type="hidden" name="cnt" value="<?php echo $cnt; ?>"/> Your question is a little unclear, so I may be misunderstanding what you want. Paul -- Paul M. Foster -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php