Re: Functions

From: Date: Tue, 03 Feb 2004 00:58:36 +0000
Subject: Re: Functions
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-32763@lists.php.net to get a copy of this message
Chis, I think this might do what you want: foreach ($_REQUEST as $key => $value) { switch ($key) { case "email": // do email stuff break; case "address": // do address stuff break; default: // in case it's something you haven't planned for.. break; } } On Mon February 2 2004 4:36 pm, Chris Payne wrote: > Hi there everyone, > > I need to write a function (New to them but starting to get the hang of it) > that will take the field from a form and then do operations on it (To > remove bad characters, any entered mysql commands etc ....) now that's not > a problem, what I want to do though is write a generic function that will > handle ALL the fields in any form. > > For example, if I have 3 input boxes, name, address, email - I would like > the function to recieve the data from each form string and do the operation > and then send the info back keeping the same name and value that it arrived > in. I'm finding it hard to explain, but basically if a field is called > email and it's value is me@me.com then the function needs to be able to > automatically pickup that the incoming name is email and it's value it > me@me.com then process it and output it again, and i'm confused how to do > it. > > I can do it if I specify the name of the form item coming in and going out, > but since I want to make it generic I don't want a zillion different > possible form names in the function :-) > > Any help (If you can understand my rambling :-) would be greatly > appreciated. > > Regards > > Chris

« previous php.db (#32763) next »