SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Apr 2006
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    best method for add/mod/del/read within same php script

    I need a single handler to handle all my request eg. add/mod/del/read.
    Could any one suggest me which some algorithm for the best so that all request will be handle through single handler.

    eg. While adding I did not passing the primary key to php script so it does insertion and whenever it gets primary key it does updates on it

    I am using the same page for addition as well as for updation.

    Pseudo code


    $obj->getByID($_POST[ID]);

    if($_POST && $_POST["add"]==1)
    {

    $obj->addUpdate($_POST);
    }


    Now everytime I need to pass ID from update page and then I passed this ID to object to get its records based on it it dynamically create <input> element with ID.

    I want something better which should allow me directly add/update without checking up all these element in POST

    Please help.

    Thank you
    Vijay

  2. #2
    SitePoint Evangelist
    Join Date
    Jun 2003
    Location
    Melbourne, Australia
    Posts
    440
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If users enter updated information into a form which is then submitted using POST, there's no other way. The updates will come from POST, so you have to pass it to your object at some point.
    Zealotry is contingent upon 100 posts and addiction 200?

  3. #3
    SitePoint Member
    Join Date
    Apr 2006
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks But I am looking for kind of handler or controller to handle these request on the single php script.


Bookmarks

Posting Permissions

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