Hi, I have the following code:
for (my $eu=0;$eu<=(scalar(@identifier));$eu++){ foreach my $id(@idfeat) { if ($id eq $identifier[$eu]){ my $sth=$dbh->prepare("INSERT INTO dd VALUES('$identif +ier[$eu]','Feature')"); $sth->execute(); $sth->finish; } else {my $sth=$dbh->prepare("INSERT INTO dd VALUES('$i +dentifier[$eu]','Bug')"); $sth->execute(); $sth->finish; } } }
What I want to insert in the database is the result of an html form. In the html form, for each element of the array @identifier i have a checkbox:if it's checked then I will insert that element in the database as Feature, if it's not checked i will insert as Bug in database. So I will have in @idfeat those elements from @identifier that are checked: example: @identifier=("A1","B1","C1","D1"); @idfeat=("A1","B1");this means that A1and B1 are checked in the html form so they are Feature: I want my database to look like this:
A1 Feature B1 Feature C1 Bug D1 Bug
But in the way I do it it looks like this:
A1 Feature A1 Bug B1 Feature B1 Bug C1 Bug C1 Bug D1 Bug D1 Bug
Thank you for your time

In reply to inserting in a database by bory

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.