Jump to content

User selects existing from dropdown or fills in new record (webform) questions


GorgeNouri

Recommended Posts

environment: PHP Version 4.4.4, php-mysql 3.23.54, MySQL server version 4.1.18

(unfortunately I can't change any of them due to dependencies)

So far I have only created auth and email forms using php and mysql in my web-life, and did that working from existing examples, which went easy for me. However, now I need to create some fairly complex webforms for some people, and I bump into a lot of issues that are not so easy to find examples for.

The intention is to make certain parts of a large database easier to add new records to and/or change by certain groups of people, and for that I have to create some webforms. One important thing is that they want me to put many form actions on just one page, with one submit button. For now let's assume all related fields are of the varchar(128) type to keep it simple.

 

(Restricting access is not an issue (I have that down) because it works outside of the form using a cms-type thing, giving access for the form only to those that are allowed to add or change records etc.)

 

Let me describe some of the involved structure and actions I need for one of the forms, because when I get one done (with help of some example code from you freaks preferably), it's easy for me to understand and create more out of it;

 

In an existing (and already populated) TABLE_X the user needs to add a new record to field_x

but I need to give the user a dropdown so user can check if needed field_x already exists, if it does, it should be selected from that dropdown to continue further in the form, if it does not exist it should be filled in a textbox by the user and then continue further down the form.

Aside from this, whatever the user has picked (picking an existing one or filling in something new) ALSO needs to go into field_y which resides in TABLE_Y and in field_z residing in TABLE_Z (but this happens hidden from the user).

 

In the same form-page I then need to have a dropdown box showing the records in field_a from TABLE_A but show only those records in the dropdown for which field_b (from TABLE_A) has values (record) xx and yy.

The user selected item from field_a should be added as field_h which resides under TABLE_H

 

Then I have a couple more that are similar to this on the same page. Basically I need a complete example (including where I need to put the include for the connection to the database) so I understand how to create the user selects existing or adds new record issue in a webform, plus I'm at a total loss on doing the cross table writing and reading in one form.

 

If anyone could provide a simple example using the exact table and field names mentioned in my puzzle above, I'd be on my way and very thankful!

 

By the way, do you think I should use AJAX to help me with this? And I also found some useful javascript here that might come in handy for opening up a textarea if the entry does not exist in a dropdown: http://www.formassembly.com/wForms/v2.0/documentation/conditional-sections.php

 

Thanks!

 

Nouri

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.