473,503 Members | 1,639 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Form submission

18 New Member
If I have a form with 50-200 input fields, how can I submit them as one PHP/MYSQL insert command?

Ex. Form has input fields of: Lastname, Firstname, SS#, favorite color.
How can I submit all of these/consolidate into a MYSQL table with field name Personalinfo?

Thank you in advance,
MO
Oct 7 '09 #1
1 1318
Atli
5,058 Recognized Expert Expert
Hey.

You want to insert the data form 50-200 form input fields into a single field in a MySQL table?!
You never put more than a single piece of data into a single field. It's the first, and most important, rule of database design.

If you need to store 50-200 pieces of personal info on your users, you either create a single table that has 200 columns, one for each possible piece of data (not every field has to be filled for each row), or you create a "dynamic" table, where you just store a key/value pair, filling in each as you go.

Example of the first option: (very basic)
Expand|Select|Wrap|Line Numbers
  1. +----+-----------+-----------+----------+---------------+--------+
  2. | id | ss_number | firstname | lastname | favorit_color | etc... |
  3. +----+-----------+-----------+----------+---------------+--------+
  4. |  1 | 11111111  | John      | Doe      | Blue          | ...    |
  5. |  2 | NULL      | Jane      | Doe      | Red           | ...    |
  6. +----+-----------+-----------+----------+---------------+--------+
(Note the NULL for the second row's ss_number field. Indicates that there was no value provided for that field.)

Example of the second option:
Expand|Select|Wrap|Line Numbers
  1. +----+-----------+----------+
  2. | id | firstname | lastname |
  3. +----+-----------+----------+
  4. |  1 | John      | Doe      |
  5. |  2 | Jane      | Doe      |
  6. +----+-----------+----------+
  7. +----+---------+---------------+-----------+
  8. | id | user_id | key           | value     |
  9. +----+---------+---------------+-----------+
  10. |  1 |       1 | favorit_color | Blue      |
  11. |  2 |       1 | ss_number     | 11111111  |
  12. |  3 |       2 | favorit_color | Red       |
  13. +----+---------+---------------+-----------+
(Here, the absence of the second user's ss_number just means that it is not inserted into the key/value table.)
Oct 7 '09 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

9
1985
by: Tom | last post by:
I have created the following code for a product select/payment form (don't know if there is a better way) and I have been trying to make the following changes (unsuccessfully so far): 1) ...
5
6072
by: Richard Cornford | last post by:
I am interested in hearing opinions on the semantic meaning of FORM (elements) in HTML. I have to start of apologising because this question arose in a context that is not applicable to the...
3
2894
by: Jack | last post by:
Hi, I have a asp input form of a financial report. Here most of the fields are text boxes where the user need to input the values corresponding to an item. However, there are few items which are...
2
7018
by: Andy Goldstein | last post by:
I have a table where all the TRs have an onClick handler registered. One (and only one) of the rows has 2 text input boxes, where each textbox has an onChange handler registered. Both the onClick...
3
1895
by: Chris Smith | last post by:
Good morning, Is there a good way to use JavaScript to send a form submission, but get back the response as a string, rather than loading it into a page? I could write the code to send the...
8
4752
by: yawnmoth | last post by:
Say I have the following HTML: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title></title> </head> <body> <form action="">
6
11863
by: Oleg Konovalov | last post by:
Hi, I have a Java/JavaScript GUI application where I perform a lot of long DB operations , which takes 5-60 secs to perform. Sometimes user double-clicks the button or just gets impatient and...
1
2492
by: Homer | last post by:
Hi, I just got a requirement from my HR department to automate their form submission process and integrate it into the Intranet project that I had just completed Phase 1 of. Because of the...
1
2240
by: rn5arn5a | last post by:
Nowadays, most websites make use of CAPTCHA to prevent automated Form submission. Can someone please give me examples of how automated Form submission can be achieved? It's not that I intend to...
8
4329
Megalog
by: Megalog | last post by:
Hey guys.. my turn to ask a question: I'm having a weird issue with a form I've reworked. This form has a combo box, which when used is changing the recordsource of a subform. This subform has...
0
7202
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7084
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7278
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7328
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7458
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5578
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
1512
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
736
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
380
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.