lisaw has asked for the wisdom of the Perl Monks concerning the following question:
################################################################# # Open the database to write data, changing the neccesary lines # ################################################################# if ($input{'action'} eq 'add'){ open (DATABASE1,">>$database"); print DATABASE1 "$input{'ncompany_name'}|$input{'nstreet'}|$input{'nci +ty_st_zip'}|$input{'nphone'}|$input{'nfax'}|$input{'nwebsite'}|$input +{'nemail'}|$input{'ncategory'}|$input{'nstorefront'}|$input{'nlogo'}| +$input{'nalpha'}|$input{'nfirst_name'}\n"; close (DATABASE1); } ################################################################# # Open the database to write data, changing the neccesary lines # ################################################################# if ($input{'action'} eq 'delete'){ open (DATABASE,">$database"); @DB=<DATABASE>; foreach $rec (@ODB){ chomp($rec); ($company_name,$street,$city_st_zip,$phone,$fax,$website,$emai +l,$category,$storefront,$logo,$alpha,$first_name)=split(/\|/,$rec); if ($company_name eq $input{'company_name'} && $street eq $inp +ut{'street'} && $city_st_zip eq $input{'city_st_zip'} && $phone eq $i +nput{'phone'} && $fax eq $input{'fax'} && $website eq $input{'website +'} && $email eq $input{'email'} && $category eq $input{'category'} && + $storefront eq $input{'storefront'} && $logo eq $input{'logo'} && $a +lpha eq $input{'alpha'} && $first_name eq $input{'first_name'} ){ print DATABASE ""; }else{ print DATABASE "$company_name|$street|$city_st_zip|$phone|$fax +|$website|$email|$category|$storefront|$logo|$alpha|$first_name\n"; } } close (DATABASE); } ######################################## print "Location: $databaseview\n\n"; ######################################## # Code to get the data from GET & POST # ######################################## sub parse_form { read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); if (length($buffer) < 5) { $buffer = $ENV{QUERY_STRING}; } @pairs = split(/&/, $buffer); foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $input{$name} = $value; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Wierd DB Question
by jonjacobmoon (Pilgrim) on Jan 29, 2002 at 05:26 UTC | |
|
Re: Wierd DB Question
by count0 (Friar) on Jan 29, 2002 at 09:18 UTC | |
|
Re: Wierd DB Question
by trs80 (Priest) on Jan 29, 2002 at 06:39 UTC | |
|
Re: Wierd DB Question
by dhammaBum (Acolyte) on Jan 29, 2002 at 09:35 UTC |