I have an HTML form that has checkboxes that sends to my form. The problem is, it only prints the first value they select rather than each choice. Ie, if they select every possible checkbox from the group, the only value that shows up in the email is Video/DVD. If they select all but the first one, Software it the only one shown.

What am I doing wrong?

The script code is:

my $consider1 = param('consider1'); sub email { open (MAIL, "| $sendmail -t") or die "Cannot open sendmail: $!"; print MAIL "To: $adminmail\n"; print MAIL "From: $usermail\n"; print MAIL "Subject: $subject\n\n"; print MAIL "--------------------\n"; print MAIL "Name: $username\n"; print MAIL "Email: $usermail\n"; print MAIL "Date: $time\n"; print MAIL "--------------------\n"; print MAIL "\n\n"; print MAIL "Question 1:\n"; print MAIL "What is your biggest problem?\n"; print MAIL " $problem1\n"; print MAIL "How would you like this solution delivered?\n"; print MAIL " $delivery1\n"; print MAIL "If Kent created this product, what price would be outs +ide of your budget?\n"; print MAIL " $toomuch1\n"; print MAIL "If Kent created this product, at what price would you +CONSIDER buying it?\n"; print MAIL " $consider1\n"; print MAIL "If Kent created this product, at what price would you +MOST SURELY buy it?\n"; print MAIL " $willbuy1\n"; print MAIL "If Kent created this product, what price would be too +undervalued that you wouldn't purchase it? \n"; print MAIL " $toolittle1\n"; close(MAIL) or die "Cannot close $sendmail: $!"; }
The HTML section is:
<td><p align="left"> <input name="delivery1" type="checkbox" id="delivery1" value=" +Video/DVD"> Video/DVD&nbsp;&nbsp;&nbsp; <input name="delivery1" type="checkbox" id="delivery1" value=" +Online Video"> Online Video &nbsp;<br> <input name="delivery1" type="checkbox" id="delivery1" value=" +Software"> Software &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <input name="delivery1" type="checkbox" id="delivery1" value=" +Electronic Book"> Electronic Book <br> <input name="delivery1" type="checkbox" id="delivery1" value=" +Physical Book"> Physical Book <input name="delivery1" type="checkbox" id="delivery1" value=" +Live Seminar"> Live Seminar <br> <input name="delivery1" type="checkbox" id="delivery1" value=" +Telephone Seminar"> Telephone Seminar </p> </td>

In reply to Checkboxes by Anonymous Monk

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.