I'm having problems in the area of my if then elsif statement. Need to inject a if then elsif statement so if any of my fields are blank within my HTML form to then send a error mesg back to user until all fields have been inputted then I will send a confirmation mesg....Can anyone show me how to correctly adjust this section
#!/usr/bin/perl -w # $form_data = $ENV{'QUERY_STRING'}; $form_data =~ s/%([\dA-Fa-f][\dA-Fa-f])/pack ("C",hex ($1))/eg; # Replace "+" sign with " "space char. $form_data =~ s/\+/ /g; # Split $form_data into name/value pairs: @fields = split (/&/, $form_data); # Init variables with form data values from following fields: # From Text Fields: ($form_name, $candidate) = split (/=/, $fields[0]); ($form_name, $position) = split (/=/, $fields[1]); # From Radio buttons: ($form_name, $education) = split (/=/, $fields[2]); ($form_name, $status) = split (/=/, $fields[3]); ($form_name, $hired) = split (/=/, $fields[4]); # From Comments Field: ($form_name, $comments) = split (/=/, $fields[5]); # Print and append file dataform.html # Heres the area I'm having problems with... # Need to inject a if then elsif statement because # if any of my fields are blank within my HTML form I need it to send # a error mesg until all fields have been inputted then I need to send # the below confirmation mesg....Can anyone show me how to correctly a +djust # my script:) if (!$.....){ print "error }elsif (!$.....){ print error.. ... .. } esle # print good stuff to screen and to { open(OUT, ">> dataform.html") or die "Can't open file: $!"; print OUT "CANDIDATE: $candidate\n"; print OUT "POSITION TYPE: $position\n"; print OUT "LEVEL OF EDUCATION: $education\n"; #print OUT "STATUS OF AGREEMENT: $status\n"; #print OUT "WAS HE OR SHE HIRED?: $hired\n"; close OUT; } # Send back user confirmation: print << "END_OF_REPLY"; Content-type: text/html <HTML> <HEAD> <TITLE> Confirmation</TITLE> </HEAD> <BR><BR><BR> <H1 ALIGN=CENTER>Thankyou $candidate !</H1> <BR> <H1 ALIGN=CENTER>The $position position is vacant!!</H1> <BR> <H1 ALIGN=CENTER>It will take us several weeks to process.</H1> <BR> <H1 ALIGN=CENTER>Computer Network Division Inc</H1> <BR> </HTML> END_OF_REPLY

Edit: chipmunk 2001-11-30


In reply to Can anyone adjust my script correctly:) by villa

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.