[FX.php List] Accepting user input on multiple records simultaneously

Jonathan Schwartz jonathan at exit445.com
Tue Apr 24 10:43:22 MDT 2007


Thanks Leo,

I'm going to have to study this later today.  Not enough brain cells 
to wrap around this interesting idea while dealing with client 
"emergencies". ;-)

Jonathan


At 5:16 PM +0200 4/24/07, Leo R. Lundgren wrote:
>I'm not sure what your form fields look like, but perhaps you should 
>consider placing them inside a holder, for example:
>
>	<input type="text" name="dataRecords[$id]">
>
>That will make the form contain several fields with different names 
>as seen by the browser/HTML, but when PHP fetches it, it'll 
>interpret it PHP-style, so you effectively have an array 
>$POST['dataRecords'], which you can loop, for example:
>
>	foreach($_POST['dataRecords'] as $id => $record) {
>		// Do stuff..
>	}
>
>Unless it's an unusual case, I'd do it that way. I'd feel having a 
>lot of variables in the $POST space, having the names of integers, 
>is out of control (not literally, but it's not a nice thing :).
>
>Regards, Leo
>
>
>24 apr 2007 kl. 17.02 skrev Andrew Denman:
>
>>You can do an unset($_POST['click']); before running the foreach.
>>
>>Andrew Denman
>>
>>
>>From: fx.php_list-bounces at mail.iviking.org 
>>[<mailto:fx.php_list-bounces at mail.iviking.org>mailto:fx.php_list-bounces at mail.iviking.org] 
>>On Behalf Of Jonathan Schwartz
>>Sent: Monday, April 23, 2007 8:35 PM
>>To: FX.php Discussion List
>>Subject: Re: [FX.php List] Accepting user input on multiple records 
>>simultaneously
>>
>>Almost there with the brute force solution....
>>
>>So far, I have:
>>
>>
>>1)Addedacheckboxtoeverylineiteminthelinelistingoffoundrecords.
>>
>>
>>2)Addedaformaroundtheentirelisting,withsubmitbutton.
>>
>>
>>3)Pointedthesubmitbuttontoanewfilethatprocessesthe$_POSTarray(thisistherootofthequestion)
>>
>>
>>4)performaforeachtoupdateeachrecordwiththe-recidsentoverfromthecheckboxontheoriginalpage.
>>
>>Everything works in spite of my fumbling. The only problem is that 
>>I am using $_POST which returns exactly 1 line more than the actual 
>>number of boxes checked (the input buttton name is included):
>>
>>[1] => 1
>>
>>[2] => 2
>>[3] => 3
>>[32] => 32
>>[34] => 34
>>[37] => 37
>>[41] => 41
>>[44] => 44
>>[48] => 48
>>[52] => 52
>>[click] => Submit Selections
>>
>>So, the final loop of the foreach produces an error.
>>
>>Is there a better way to handle the array from the $_POST?
>>
>>J
>>
>>--
>>
>>Jonathan Schwartz
>>
>>Exit 445 Group
>>
>><mailto:jonathan at exit445.com>jonathan at exit445.com
>>
>><http://www.exit445.com>http://www.exit445.com
>>
>>415-381-1852
>>
>>FileMaker 8 Certified Developer
>>
>>_______________________________________________
>>FX.php_List mailing list
>><mailto:FX.php_List at mail.iviking.org>FX.php_List at mail.iviking.org
>><http://www.iviking.org/mailman/listinfo/fx.php_list>http://www.iviking.org/mailman/listinfo/fx.php_list
>>
>
>
>_______________________________________________
>FX.php_List mailing list
>FX.php_List at mail.iviking.org
>http://www.iviking.org/mailman/listinfo/fx.php_list


-- 
Jonathan Schwartz
Exit 445 Group
jonathan at exit445.com
http://www.exit445.com
415-381-1852
FileMaker 8 Certified Developer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.iviking.org/pipermail/fx.php_list/attachments/20070424/43f4f4f2/attachment.html


More information about the FX.php_List mailing list