I have a CGI script that builds html forms, does DB access, DB creation, etc. I need to be able to easily modify it for others in our company to use. I thought I could use hash keys and values to accomplish this. I am integrating pager systems one uses a website the other files on a unix system. The web based script stores its information in a mysql DB. Different groups want to have their own system that stores different information in the DB and desire different displays of this information. Only a small portion of the DB data is required for the actual paging systems but folks would like to consolidate their information there. How to do this or is there a much better way. Here is my 1st idea a code sample that reads the form values specified in a hash, I would also use the hash(es) to build the DB, html forms, ect. -
use CGI;
%var_name = (
opp => 'Operation',
name => 'Name',
);
for $vname (keys %var_name){
$statement='$'.qq!$vname = param('$vname')!;
# this did not work
eval{ $statement };
# nor did this
${statement};
print "$vname is $${vname}<br>\n";
}
This code would create these perl statements which I would need to have it execute.
$opp=param('opp');
$name=param('name');
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.