Newsgroup: it.comp.lang.perl
Titolo: GET & POST

Firstly if I have posted this somewhere I shouldn't of done please let me
know.
I don't understand this?????
OK I a new to Perl, but I have an HTML from that sends information to a Perl
script. The from contains various text fields and an array of check boxes
with the name set to 'Area'
If the form 'METHOD' is 'POST' it sends the information over but only sends
value of the last checked box. i.e. if all of these were checked and sent
then the 'Area' = West Sussex
<INPUT TYPE="CHECKBOX" NAME="Area" VALUE="Wiltshire">
<INPUT TYPE="CHECKBOX" NAME="Area" VALUE="West Yorkshire>
<INPUT TYPE="CHECKBOX" NAME="Area" VALUE="West Sussex>
In order to send all the information over I need to send it using 'GET' but
when is get to the Perl script it doesn't seem to know any of the
information. Below is a small chunk of the script, how do I get it so it
sees the information I send the script?
Any help would be great
############################
  # Something was left blank #
  ############################
 if (($in{'name'} eq "") ||
  ($in{'Title'} eq "") ||
  ($in{'type'} eq "") ||
  ($in{'karaoke'} eq "") ||
  ($in{'house'} eq "") ||
  ($in{'town'} eq "") ||
  ($in{'county'} eq "") ||
  ($in{'postcode'} eq "") ||
  ($in{'URL'} eq "") ||
  ($in{'Area'} eq "") ||
  ($in{'Description'} eq "") ||
  ($in{'terms'} eq "")) {
  &PrintHeader;
  print "<html>\n <head>\n <title>Error:  Blank Entry</title>\n </head>\n";
  print "$Header\n";
  print "<P ALIGN=\"CENTER\"><B><FONT SIZE=\"+1\" COLOR=\"#FF0000\">You did
not enter in all the information requested.  <BR>Please click the
<U>BACK</U> button and make sure everything is filled in.</FONT></B></P>\n";
  print "$Footer\n";
  print "$copyright\n";
  exit;
 }
  ######################################
  # Check to see that the URL is valid #
  ######################################
 $CheckURL = substr ($in{'URL'}, 0, 7);
 if ($CheckURL ne "http://") {
  &PrintHeader;
  print "<html>\n <head>\n <title>Error:  URL Invalid</title>\n </head>\n";
  print "$Header\n";
  print "<P ALIGN=\"CENTER\"><B><FONT SIZE=\"+2\" COLOR=\"#000000\">The URL
you entered seems to be invalid. It should start with &quot;http://&quot;.
<BR>Please click the <U>BACK</U> button and check your
url.</FONT></B></P>\n";
  print "$Footer\n";
  print "$copyright\n";
  exit;
 }

 Any help would be great
First of all it may depend oin how yo do the parsing of input.
Looking in the code you provide I assume you're using "cgi-lib".
If that's actually the case when the form has many fields with a single
name, the corresponding string after parsing looks like:
field one\0field two
i.e.: field values are concatenated and separated with \0
If you use the CGI package, then after the parse you get an array for
multiple valued parameters (or a single field if you use it in a string
context).
You may find useful the small script below which is an "echo" program
(returns back all the information gathered from a form):
==========================================================================
#!/usr/local/bin/perl
use CGI;
$q = new CGI;
$|=1;
print $q->header();
open(STDERR,">&STDOUT");
print "<h2>Environment variables</h2>\n\n";
print "<pre>\n";
foreach $k (sort keys %ENV) {
	print "<b>$k</b>: $ENV{$k}\n";
}
print "</pre>\n\n";
@par=$q->param;
$npar=$#par+1;
print "<h2>Input parameters ($npar)</h2>\n\n";
print "<pre>\n";
foreach $k ( @par) {
	@v=$q->param($k);
	$s="<b>$k</b>:";
	$b='<b>' . ' ' x length($k) . '</b> ';
	for($i=0;$i<=$#v;$i++) {
		print "$s $v[$i]\n";
		$s=$b;
	}
}
 
print "</pre>\n\n";
--------------------------------------------------------------------------
       -- )     Luca Fini                            Tel: +39 055 2752 307
 ___    |\      Osservatorio Astrofisico di Arcetri  Fax: +39 055 2752 292
/   |   | |-_   L.go E.Fermi, 5 +-----------------------------------------
(___|___//___)  50125 Firenze  /   WWW: 
http://www.arcetri.astro.it/~lfini
 (_)      (_)   Italia        / e-mail: 
lf...@arcetri.astro.it
-----------------------------+--------------------------------------------
                              In a world without fences - who needs GATES?