Click to See Complete Forum and Search --> : Dynamic Comment Boxes: Hard to get correct $_POST


auxone
05-16-2008, 02:25 PM
this code is in a while loop which dynamically creates a comment box for each thread in a type of forum; multiple threads are seen on the same page with multiple comment boxes.

<textarea wrap="soft" name="<?=$rowzero?>" rows="2" cols="25"></textarea>
<input type="submit" name="submit" value="OK" />

$rowzero is an integer and associates the comment box to the post, and is gathered from the DB when the thread loads. When user clicks submit, then $_POST[$rowzero] should contain the text for the comment, but my problem is after a submit $rowzero is NULL. I tried putting the code that adds the comment to the DB AFTER $rowzero is accessed from the DB, which means I have to reload the page to see the comment updated. This is unacceptable. I need a way to realize which $_POST[##] I should be accessing for the comment.

Any suggestions?

Thanks in advance,
Tyler

PS> To clarify, when user hits submit $_POST makes an associative array of all the comment boxes on the page, most of which contain nothing. I was thinking of some type of loop to see which one had something, but my $rowzero is int(11) so that could be prohibitive, and POST is associative.

auxone
05-16-2008, 05:02 PM
I figured it out. Sometimes typing it all is the best way to get your thoughts straight.. I just added a hidden field that had the number of the $_POST[] I needed, so now it sends two variables.