Gossamer Forum
Home : General : Perl Programming :

Checkbox testing

Quote Reply
Checkbox testing
I am trying to setup a form with checkboxes(articles). Once the user has checked the appropriate box, I want to test them to see which article is to be sent via email. I can't seem to get the testing correct. Any help at all will be appreciated.
Quote Reply
Re: [awfahey] Checkbox testing In reply to
Please begin by showing us what you tried.
Quote Reply
Re: [Paul] Checkbox testing In reply to
$admin_email = 'news@compdb.com';
$subject = 'Requested Projections';
$file_directory = '/mnt/web/guide/analytical-consulting/wwwfp/news';
$mail_program = "/usr/sbin/sendmail";

$ScriptURL = "http://$ENV{'SERVER_NAME'}$ENV{'SCRIPT_NAME'}";

# print "Content-type: text/html\n\n";

if($FORM{action} eq 'send') {
if(check_email($FORM{'email'})) {
use MongerMail;
my $mail = new MongerMail($mail_program);

$mail->content("Attached is the Information that you requested.\nby Thank you for visiting our site");
print $FORM{'email'};
if(hightech.checked == true){

print "Thank you! The file has been mailed!\n";
} else {
print "OOPS! The e-mail address you entered was not in a valid email address format.";
} else {
print "<div align=\"center\">\n";
print"<table border=\"9\" cellpadding=\"0\" cellspacing=\"0\" width=\"96%\" bgcolor=\"#C0C0C0\" bordercolorlight=\"#FFFFFF\">\n";
print"<td width=\"100%\">\n";
print"<p align=\"center\"><font size=\"4\" color=\"#0000FF\">Analytical Consulting
Companies Registration Form<br></font></p>\n";
print"<td width=\"100%\">\n";

print "<FORM name=docfrm ACTION=\"$ScriptURL\" METHOD=\"POST\">\n";
print "<INPUT TYPE=\"HIDDEN\" NAME=\"action\" VALUE=\"send\">\n";
print "&nbsp;&nbsp;Name:<br><INPUT TYPE=\"TEXT\" NAME=\"name\" VALUE=\"$FORM{name}\" SIZE=40><BR>\n";
print "&nbsp;&nbsp;Company:<br><INPUT TYPE=\"TEXT\" NAME=\"company\" VALUE=\"$FORM{company}\" SIZE=40><BR>\n";
print "&nbsp;&nbsp;Address:<br><INPUT TYPE=\"TEXT\" NAME=\"address\" VALUE=\"$FORM{address}\" SIZE=40><BR>\n";
print "&nbsp;&nbsp;City:<br><INPUT TYPE=\"TEXT\" NAME=\"city\" VALUE=\"$FORM{city}\" SIZE=30><br>\n";
print "&nbsp;&nbsp;State:<br><INPUT TYPE=\"TEXT\" NAME=\"st\" VALUE=\"$FORM{st}\" SIZE=10><br>\n";
print "&nbsp;&nbsp;Zip Code:<br><INPUT TYPE=\"TEXT\" NAME=\"zip\" VALUE=\"$FORM{zip}\" SIZE=15><BR>\n";
print "&nbsp;&nbsp;Email:<br><INPUT TYPE=\"TEXT\" NAME=\"email\" VALUE=\"$FORM{email}\" SIZE=40><BR>\n";
print "<div align=center>\n";
print "<span style=\"font-variant: small-caps\"><font color=\"#800000\">I would like to
receive the 2003-2004 salary increase projections</font><font color=\"#0000FF\"><br>\n";
print "<input type=\"checkbox\" name=\"genbus\" >&nbsp; </font></span><font face=\"Arial\" size=\"2\" color=\"#000000\">General
Business/Industry Sector<span style=\"font-variant: small-caps\">&nbsp;</span></font>\n";
print "<span style=\"font-variant: small-caps\"><font color=\"#0000FF\">\n";
print" <input type=\"checkbox\" name=\"hightech\" value=\"ON\">&nbsp; </font></span>\n";
print "<font size=\"2\" color=\"#000000\"><font face=\"Arial\">High Technology Sector&nbsp;
print "<input type=\"checkbox\" name=\"ec\" value=\"ON\"> <font face=\"Arial\">Engineering and Construction
print"<span style=\"font-variant: small-caps\"><font color=\"#0000FF\"><br>
print "<font size=\"1\" color=\"#FF0000\">&nbsp; </font><font color=\"#FF0000\" size=\"3\">
<b>*</b> </font>\n";
print "<font color=\"#0000FF\" size=\"1\"><b>Required

print"<div align=center>\n";

print "<INPUT TYPE=\"SUBMIT\" VALUE=\"Send it now!\"></FORM></td>

Last edited by:

Wil: Jun 9, 2003, 10:44 AM
Quote Reply
Re: [awfahey] Checkbox testing In reply to
Can I suggest a few things for you before you get any further.

use strict;
use CGI;
use CGI::Application;

Learn to seperate HTML from code using a templating module. CGI::Application ties in well with HTML::Template. There are also hooks into HTML::Mason.

If you don't want to use a templating system, at least consider HERE docs.

- wil
Quote Reply
Re: [Wil] Checkbox testing In reply to
Frown I' afraid you lost me.