[pmwiki-users] Dinamic Forms

Peter Bowers pbowers at pobox.com
Wed May 13 07:56:26 CDT 2009


On Wed, May 13, 2009 at 1:52 PM, edwin marte <edwin.marte at leidba.com> wrote:

> The escenario is the following: there are 3 variables (PTV), they come from
> pagelist and diferent groups. I have manage to create the form in the way I
> wanted but the problem
> is that I do not find a way to summit the data once is filled. The data
> after summision have to be saved in each individual page.
>
> Lets say the 3 pages are called page1, page2 and page3. They all have a PTV
> named value. What I would like to do is been able to modified those values
> and post it back to each page. My actual system has about 20 ptvs or pages.


You didn't mention which forms processor you're using, so I'm assuming you
are handling it yourself from a PHP scripting stnadpoint.

When I've had to do this I simply named my fields value_page1, value_page2,
etc.  Then in my form processing I did something like this (UNTESTED,
nonfunctional code):

foreach ($_REQUEST as $k => $v) {
   if (!preg_match('/^value_(.*)/', $k, $m)) continue; // skip any unrelated
GET/POST fields
   $pn = MakePageName($m[1]);
   # Now save your data using $v as the data itself and $pn as the page to
which to save it
   # Perhaps using ptvwrite() from Cookbook/Toolbox
}

If you're using some other forms processor (fox, pmforms, etc.) then
obviously this solution would be unhelpful...

Probably using value[page1] as your field name would be more elegant.

-Peter
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.pmichaud.com/pipermail/pmwiki-users/attachments/20090513/ac1218ce/attachment-0001.html 


More information about the pmwiki-users mailing list