• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 182
  • Last Modified:

Application Form Setup (Adviced Needed)

Hi all,
I'm developing an online application form and need the best way to store the information in the database. I haven't done a project similar to this before so my knowledge is a bit hazy :)
Basically, the application can either be joint (2 users) or single (1 user). I wondering what is the best way to design the interface to cater for this? Would it be better to build 2 different pages for each section, the first with only 1 field for each section (e.g. 1 username for 1 user) and the second page with 2 fields under the same row in the table (for 2 users). Or, would it be easier to build a page with 2 columns, column 1 for user 1 and column for user 2 and write some javascript so that when the applicant selects a single user, the second column is not submitted to the database .I problem with this second method, which would probably be a better solution, is that I only want to update the user 2 fields in the database if information is entered into them. Obviously when they are invisible no information would be entered into them. Is this easy to setup or does this happen automatically when I set up a statement in PHP similar to this:
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "server_form")) {
  $insertSQL = sprintf("INSERT INTO details_table (det_username, det_email_add, det_model_id) VALUES (%s, %s, %s)",
Any input on the matter would be greatly appreciated,
Thanks,
D
0
dereksheahan
Asked:
dereksheahan
  • 2
1 Solution
 
ClickCentricCommented:
This really depends on what the next step after this is.  It sounds almost like you want to create 2 seperate forms and have them both submit at the same time.  This can be achieved via javascript, but it can be tricky to deal with the results.
0
 
TeRReFCommented:
Maybe you should use 2 pages.
Page 1. Ask if it will be single user or not
Page 2. Serve the form applicable to the user choice

Of course you should implement validation of the form fields...

0
 
dereksheahanAuthor Commented:
Hi guys, yes I plan I having two pages like you suggest (TeRReF). I guess the main think I need to figure out at the moment is how hard is it to add or update two records to the one table at the same time? For example, on one page there will be two primary key auto-numbered user_ids created (two username fields, etc) and I want both of them to go to the one table in the database. How hard is this to achieve?
Thanks,
D
0
 
ClickCentricCommented:
It's a snap to update 2 records as long as you keep the field ID's clearly seperated.  As for doing it 'at the same time', I think it would have to be split into 2 calls (I don't *think* you can do 2 update calls on the same line), but it shouldn't be an issue either way as long as you're careful about naming the form fields.  Use different prefixes like user1_ and user2_ or some such when naming them to make sure they don't get confused for each other.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now