Edited** Being a Perl newbie is tough lol. I just used regex and my hash I read my cgi paramaters into.
my $regex = qr/tierrate/;
my $count = 0;
foreach (grep { /$regex/ } keys %form) {
$count++;
}
Then I can just use that count to determine my insert loop.
once again, I'm new to programming. My Jquery and Perl skills are beginner at best.
I'm looking to be able to insert multiple records into a database table based on the amount of table rows added by the user. I'm not really sure how to handle this as this is my first nonstatic attempt. I'm using cgi.pm and dbi.pm.
I'm displaying some HTML based on a button click. I'm displaying and trying to insert "tier rate" "tier range minimum" and " tier range maximum" for each time the user selects "add tier" button. The user can click the button as many times as needed and they will get an additional table row for each click, I'm not sure how to loop through a dynamic amount of rows.
Based on the user clicking the "add tier" button, I display HTML.
\$('#addnewtier').click(function() {
\$('<tr id="inctier'+ (raisetierid++) +'"><TD ALIGN=left><font color="#ADD8E6">Tier '+ (rateplus++) +' Rate</TD><TD ALIGN=left><input type="text" name="tierrate'+ (tierrate++) +'" size=10 value="00.00" ></TD><TD ALIGN=left><font color="#ADD8E6">Tier '+ (rangeplus++) +' Range</TD><TD ALIGN=left><font color="#ADD8E6">Minimum <input type="text" name="rangemin'+ (rangemin++) +'" size=10 value="" ><font color="#ADD8E6"> Maximum <input type="text" name="rangemax'+ (rangemax++) +'" size=10 value="" ></TD>').appendTo("#inctier1");
})
The user can click the button as many times as they wish. I'm familiar with being able to grab the input on a set number of something, but not so much with a dynamic number of something. I am declaring the variables I'm incrementing just above the code I've posted. Thanks in advance for the help.