in reply to Form param checking
Which we would change as following to fit your example:#!/usr/bin/perl -wT use strict; use CGI; my $q = new CGI; print $q->header( "text/plain" ); print "These are the parameters I received:\n\n"; my( $name, $value ); foreach $name ( $q->param ) { print "$name:\n"; foreach $value ( $q->param( $name ) ) { print " $value\n"; } }
use CGI; my $q = new CGI; print $q->header( "text/html" ); if ( $q->param() ) { if( $q->param( $name ) ) { if( $q->param( $email ) ) { if( exists $emails{$q->param( $email )} ) { print "<center><b>Email already exists in database.</b +></center>\n"; } else { $emails{$q->param( $email )} = "$info"; print "<center><b>Your information was added to our sy +stem!</b></center>\n"; } } # you missed this closing brace else { print "Email was missing"; exit; } } else { print "Name was missing"; exit; } }
And last but not least, you might want to write your code so that you can see easily when you are missing an opening/closing code block brace.
/oliver/ PS: You might want to check the information you add to the emails hash for validity.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Form param checking
by Anonymous Monk on Dec 30, 2003 at 01:38 UTC | |
by jeffa (Bishop) on Dec 30, 2003 at 16:49 UTC |