#1
  1. No Profile Picture
    Contributing User
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Dec 2004
    Posts
    2,865
    Rep Power
    368

    Advice on processing forms & page setup


    I have a current campaign the page layout/step goes like this

    page 1 > process > page 2 > process > page 3.

    so process.php is doing processing for both. I then have session step to redirect to relevant step.

    This results in process being a big file so i have logic such as:
    PHP Code:
    //pseudo code
    if ( step 1) {
       
    // create xml
    } else if ( step 2){
      
    // create xml
    } else {
       
    //create xml


    send the xml to required db table
    so i was wondering if this is "ok" way of going about or should i maybe think of something else?
  2. #2
  3. Mad Scientist
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Oct 2007
    Location
    North Yorkshire, UK
    Posts
    3,660
    Rep Power
    4123
    I'd say that it's whatever works for you.

    I tend to let the client side collect all the data in one go and then submit to the server at the end. There are plenty of jQuery based form wizards (with validation) to work with. Fieldsets (inc nested fieldsets) sets helps semantically organise the html and helps with the css/display for showing/hiding each 'card'

    Then, if you like MVC ideas (or just the separation of presentation and logic) then this works nicely

    EDIT

    not knowingly used it, but just found this:

    jQuery Form Wizard

    EDIT 2,

    do knowingly use it, when I bought this template
    Last edited by Northie; October 9th, 2013 at 07:41 AM.
    I said I didn't like ORM!!! <?php $this->model->update($this->request->resources[0])->set($this->request->getData())->getData('count'); ?>

    PDO vs mysql_* functions: Find a Migration Guide Here

    [ Xeneco - T'interweb Development ] - [ Are you a Help Vampire? ] - [ Read The manual! ] - [ W3 methods - GET, POST, etc ] - [ Web Design Hell ]
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2007
    Posts
    113
    Rep Power
    0
    Can't you just wrap your 3 steps in divs with display:none on steps two and three. Then a link at the bottom of step 1 and 2.

    Use a bit of jQuery to hide step 1 div and show step 2 once a user clicks the "next step" link. That way, it's all one form, and easier to process with php..
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Dec 2004
    Posts
    2,865
    Rep Power
    368
    I can actually use JQUERY like northie said to autohide divs and then whne they click submit I can send the data from first page using JQUERY and then show the next div. (The first page is mandatory but the next two are not and i want to save user info every step of the way as to not lose anything)

    But even if i do this, I will have two files or a one big ajax file as it needs to process each form.

IMN logo majestic logo threadwatch logo seochat tools logo