Re: Functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxx then the function needs to be able to
> automatically pickup that the incoming name is email and it's value it
> me@xxxxxx 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

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux