"Ben" <ben@xxxxxxxxxxxxxxxxx> wrote in message news:4328900A.9050808@xxxxxxxxxxxxxxxxxxxx > Dan Baker wrote: >> The *main* reason I use $_REQUEST is so I can code up GET and POST pages >> that all are handled by the same php functions. I may have an item >> called "Key" that contains what the end-user is expected to be doing >> ("User.Create" or "User.Edit" or whatever). Then I may have a link (GET) >> that has ?Key=User.Create, while a form (POST) that has a hidden value >> "Key" with value "User.Create". I don't really care if it came from a >> GET or POST -- if the data is all valid, I'll allow it to work. > > How are you passing your values to your functions? If you stick to local > variables in your functions they won't care where you got the values from. > Deal with the post or get values in whatever script handles your form > submissions and have it pass the values on to your functions. > > IE > In your post handling script: > > $result=doSomething($_POST['this'],$_POST['that']); > > In your get handling script: > > $result=doSomething($_GET['this'],$_GET['that']); Aha! I direct my form's to the *exact* same page as GET's, so I don't even know if a POST or GET sent the data (generally speaking). A typical page looks something like the following: *Every* request goes to a single page (Maybe called "Page.php"), which does session management, includes several files that every page needs, and then decodes what page the end-user is actually interested in, something like: $key = explode('.', danbRequest::clean('key', 'a0._')); Now, $key[0] = the "Primary" key, the main critter the end-user is trying to do. and $key[1]... = secondary keys (maybe Edit or Create or whatever). This first key is used to branch off to various pages to handle that specific Key. Usually, I have 1 file per Key: if ($key[0] == 'Account') { include_once('......\Account.php'); account_Handler($key); } else if ($key[0] == 'Cart') { include_once('......\Cart.php'); cart_Handler($key); } DanB ps The above function "danbRequest::clean()" is a handy little function that performs almost all my cleaning of $_REQUEST values. The first argument is the name, the second argument is a list of valid characters to allow. The example given (danbRequest::clean('key', 'a0._')) will look for $_REQUEST['key'], if not found it returns "false", if found -- it takes the value and "cleans" it to only include 'a0._' (all letters, all digits, all dots and underscores). -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php