how to loop through POST variables and contents

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • NotGiven

    how to loop through POST variables and contents

    I am looking for a standard way/function to loop through all POST variables
    and their respective contents to update a database record.

    Here's my ideal to pass a function and it update:
    session variable - "ID" - that holds the record ID to update
    $_POST or $HTTP_POST_VARS

    The function would update the $_POST vaiables of the ID record with the
    $_POST variable's contents.

    Thanks for any help or links to info!


  • CountScubula

    #2
    Re: how to loop through POST variables and contents

    "NotGiven" <noname@nonegiv en.net> wrote in message
    news:2U3Jb.5623 $kK.4315@bignew s3.bellsouth.ne t...[color=blue]
    > I am looking for a standard way/function to loop through all POST[/color]
    variables[color=blue]
    > and their respective contents to update a database record.
    >
    > Here's my ideal to pass a function and it update:
    > session variable - "ID" - that holds the record ID to update
    > $_POST or $HTTP_POST_VARS
    >
    > The function would update the $_POST vaiables of the ID record with the
    > $_POST variable's contents.
    >
    > Thanks for any help or links to info!
    >
    >[/color]

    check out


    and



    --
    Mike Bradley
    http://gzen.myhq.info -- free online php tools


    Comment

    • Daniel Tryba

      #3
      Re: how to loop through POST variables and contents

      NotGiven <noname@nonegiv en.net> wrote:[color=blue]
      > I am looking for a standard way/function to loop through all POST variables
      > and their respective contents to update a database record.
      >
      > Here's my ideal to pass a function and it update:
      > session variable - "ID" - that holds the record ID to update
      > $_POST or $HTTP_POST_VARS
      >
      > The function would update the $_POST vaiables of the ID record with the
      > $_POST variable's contents.[/color]

      Use a foreach($_POST as $key => $value) block, inthere you can construct
      2 strings, one containins the keys van one the (escaped) values
      in the correct format for an insert statement (insert into $table
      ($keys) values ($values)).

      One problem you are going to run into is the differenve between numeric
      and string values in the talbe (you could fix that with a switch but
      you'd have to know what is what in thew table).

      --

      Daniel Tryba

      Comment

      Working...