villa has asked for the wisdom of the Perl Monks concerning the following question:
#!/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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Can anyone adjust my script correctly:)
by maverick (Curate) on Nov 30, 2001 at 22:44 UTC | |
|
Re: Can anyone adjust my script correctly:)
by Masem (Monsignor) on Nov 30, 2001 at 22:45 UTC | |
|
Re: Can anyone adjust my script correctly:)
by orkysoft (Friar) on Dec 01, 2001 at 03:25 UTC | |
|
(ichimunki)Re: Can someone help me adjust the below if then elsif statement:
by ichimunki (Priest) on Nov 30, 2001 at 23:05 UTC |