I am populating an HTML form with fields pulled from a database. This means that depending on many different factors, different form fields will be placed on screen that I need to read from after it's submitted.
Since the fields are always dynamic, I'm not exactly sure how to physically take the data from the form and put it back into the database.
I set up the variables to print out the text fields based off the name pulled from the DB, -, and value1-4 (not all sets of fields have all 4 possible value fields, some just have 1 or 2)
<input type="$stored_name-value1">
<input type="$stored_name-value2">
<input type="$stored_name-value3">
<input type="$stored_name-value4">
# assuming $stored_name is a NEW name and only 2 fields
<input type="$stored_name-value1">
<input type="$stored_name-value2">
The thing is, there's no "common" thing between my infinite number of different name-value1-4 pairs.
How on earth can I read in the input after they submit the form?
I think a hash would be the way to do it, but I have no idea how I could get un-like data together or what I could do to make the data similar but to the point I can break it apart later.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.