Design question

Discussion in 'PHP' started by ghadacr, Jul 31, 2007.

  1. #1
    Hey all,

    I got a design question:

    I want to design a script that can add details to a database, but the details are all going to be different:

    For instance the user will enter details such as title, surname ect ect ect....

    Once that is done, the user can add another set of details by clicking a button and another set of form with the same HTML elements embedded will appear...

    So basically is there a way of doing this is PHP, or another design technique i can use to implement this?

    Thanks in advance...
     
    ghadacr, Jul 31, 2007 IP
  2. ecentricNick

    ecentricNick Peon

    Messages:
    351
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Yes, that can be done with php. It's kind of what its best at.

    in pseudo code form, what you want is this...
    
    if(the user submitted some data){
      if (the submitted data passes validation){
       insert that data into the database;
       provide on screen infor that the record was inserted;
       clear the posted data
     }else{
       provide on screen info of what failed validation;
     }
    }
    
    display the input form, which will post back to this page
     display within form, elements for all the data we wish to capture, defaulting to any previously passed data
     display within form, submit button
    
    Code (markup):
    As you stated this was a design question, not a coding question, that's the basic design.

    It's one php page, it combines the data collection, the validation and the insertion, and if all goes well, it lets the user input another set of the same data.
     
    ecentricNick, Jul 31, 2007 IP
  3. ghadacr

    ghadacr Peon

    Messages:
    30
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks hombre.......
     
    ghadacr, Jul 31, 2007 IP
  4. nagasharmi

    nagasharmi Peon

    Messages:
    28
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    First get all value ,
    Add some to that values
    finally stored into database.

    if you want same detaisl
    just get value from database and subtract what value you added from databse value
     
    nagasharmi, Aug 2, 2007 IP