CodeIgniter Forums
Implementing a form - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Implementing a form (/showthread.php?tid=26636)



Implementing a form - El Forum - 01-19-2010

[eluser]RS71[/eluser]
Hey

I was wondering if you guys could point me in the right direction in regards to implementing a 3 step form. (1. Details, 2. Photos, 3. Confirmation)

The form is used to add new 'entries' to my app. I'm unsure on how to go about doing this - how would I link all 3 portions of the form? At the moment since the first part doesn't have any identification, I think I'd have an ID in a hidden field and use that to link to the other two portions of the form. Something like this perhaps:

1. Details            http://localhost/entry/add
2. Photos            http://localhost/entry/photos/r7dj9c
3. Confirmation  http://localhost/entry/confirmation/r7dj9c

Another concern I have is the user using the back button to correct something in first portion of the form. I think the hidden field with the ID would help in updating the entry rather than adding another if the user submits the form again.

What do you guys think?
Any help is greatly appreciated.

Cheers


Implementing a form - El Forum - 01-19-2010

[eluser]JHackamack[/eluser]
One way of doing this would be to create a controller "Entry" and adding three functions: add, photos, and confirmation.

Confirmation posts the variables to photos, which, before you display the form you insert the details into the database getting a unique ID to pass to the photos view.

In your photos view you use the hidden identifier to post to confirmation where you pull the stuff from Details & Photos together.

Then when you're looking for looking for entries you get any entries that have stuff in both tables (i would think that there would be two tables)

Your concern for editing information is valid, and depending on what you can do is place specific wording on the photos page saying you can change the information. Although if they hit the back button and change information you can set a session variable when you're doing the post to the photos that you look for in details that would either give error message, or provide an update form rather than create new.

Hopefully this makes sense before i've had caffeine.

Jacob