Useful variable testing function-VBForums
Results 1 to 3 of 3

Thread: Useful variable testing function

  1. #1

    Thread Starter
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Camden, London Mode: PPI
    Posts
    4,904

    Useful variable testing function

    This is a function I use to test for POST variables which have been passed to my scripts.

    It can be modified easily to do the same for variable passed by the GET method, cookies and uploaded files.

    Its nothing exciting but saves on typing. Feel free to use.
    PHP Code:
    /* this function tests for the presence of HTTP post variables passed to the current script
       it takes a list containing a variable number of arguments pertaining to the variable name
       as set in the name attribute of the form input tags

       if all variables passed as arguments are set - the function returns true
       if any variables are not set the function returns false

       this function is very similar to the isset() function - but saves having to write $_POST
       for each variable you want to test
     */
    function posted () {
        
    $arglist func_get_args ();
        
        foreach (
    $arglist as $arg)
            if (! isset (
    $_POST[$arg])) return false;
            
        return 
    true;

    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

  2. #2
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    I can see how that can come in handy and I'll probably use it. Thanks for the idea, visualAd.
    My evil laugh has a squeak in it.

    kristopherwilson.com

  3. #3
    Lively Member CORONA BEER's Avatar
    Join Date
    May 2004
    Location
    THE INTERNETS!
    Posts
    82
    cool ,is that how php handles post request?, i need to make my delphi app post machine info to a php script and then the script log info, but i dont know how to do it, any comments would be helpful.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.