Re: problem
| From: | teo at gecadsoftware dot com | Date: | Sun, 15 Jul 2001 16:36:27 +0000 |
| Subject: | Re: problem | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-57956@lists.php.net to get a copy of this message | ||
Hi zerosumzero!
On Sun, 15 Jul 1979, zerosumzero@yahoo.com wrote:
> I have a form with a bunch of text fields in it. The name of the fields is
> the rowid of items in my data base:
>
> <FORM METHOD="post" ACTION="edit.php3">
>
> <textarea name="23" class="field"></textarea>
> <textarea name="2" class="field"></textarea>
> <textarea name="15" class="field"></textarea>
>
> <input type="Submit" name="save" value="submit">
>
> <FORM>
>
> Now, I want to change all of the items in the DB where a rowid was submited.
>
> Is there an easy way to do this?
here's a hint:
<FORM METHOD="post" ACTION="edit.php3">
<textarea name="f[23]" class="field"></textarea>
<textarea name="f[2]" class="field"></textarea>
<textarea name="f[15]" class="field"></textarea>
<input type="Submit" name="save" value="submit">
<FORM>
$f = $HTTP_POST_VARS['f']; // if you have register globals off
foreach ($f as $rowid => $content) {
$rowid = (int)$rowid;
// add some sanity checks on $content here
$qs = "UPDATE idunnowhat SET content='$content' WHERE rowid=$rowid";
$db->query($qs); // provided that $db is an database connection object or
something
}
dere u go
-- teodor