Re: Grid edit form

From: Date: Fri, 28 Mar 2003 17:07:06 +0000
Subject: Re: Grid edit form
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-141462@lists.php.net to get a copy of this message
Then append the id to the input name. e.g. For the input form: while (odbc_fetch_row($rs)) { echo "<tr><td><input type=text name=myfield_".odbc_result($rs, "ID")." value=".odbc_result($rs, "MyFieldValue")."></td></tr>"; } And to read the data: while (odbc_fetch_row($rs)) { $sql = "update MyTable set MyFieldValue='".$_REQUEST['myfield_'.odbc_result($rs, "ID")]."' where (ID=".odbc_result($rs, "ID").")"; odbc_exec($db, $sql); } aap Daniel Harik wrote:
Jim Lucas wrote:
This is untested, but I seem to recall doing something like this on a project last year. <form method='post' action='/process.php'> <!-- row #1 --> <input type=text name='row[0][id]'> <input type=text name='row[0][name]'> <input type=text name='row[0][company]'> <input type=text name='row[0][title]'> <br> <!-- row #2 --> <input type=text name='row[1][id]'> <input type=text name='row[1][name]'> <input type=text name='row[1][company]'> <input type=text name='row[1][title]'> <br> <!-- row #3 --> <input type=text name='row[2][id]'> <input type=text name='row[2][name]'> <input type=text name='row[2][company]'> <input type=text name='row[2][title]'> <br> <input type=submit> </form>
Thank you for your reply, but i'm pulling records from db, and ids won't be 1,2,3,4......n, but more random.


« previous php.general (#141462) next »