1
2
3
print '<INPUT TYPE="CHECKBOX" NAME="par1" VALUE="true"> Parameter 1';
print '<INPUT TYPE="CHECKBOX" NAME="par2" VALUE="true"> Parameter 2';
print '<INPUT TYPE="BUTTON" VALUE="aktualisieren" ??? ">';
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
use CGI; my $cgih = CGI->new; my $par1 = $cgih->param('par1'); my $par2 = $cgih->param('par2'); my $check1 = (defined $par1 && $par1 eq 'true' ? ' checked' : ''); my $check2 = (defined $par2 && $par2 eq 'true' ? ' checked' : ''); (my $script = $0) =~ s/^.*[\\\/]//g; my $formular = <<HTML <FORM action="$script"> <INPUT TYPE="CHECKBOX" NAME="par1" VALUE="true"$check1> Parameter 1 <INPUT TYPE="CHECKBOX" NAME="par2" VALUE="true"$check2> Parameter 2 <INPUT TYPE="BUTTON" NAME="senden" VALUE="aktualisieren"> </FORM> HTML ; # Formular ausgeben print $cgih->header.$formular;
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
use CGI; my $cgih = CGI->new; my $par1 = $cgih->param('par1'); my $par2 = $cgih->param('par2'); my $formular = qq( <FORM> <INPUT TYPE="CHECKBOX" NAME="par1" VALUE="true"> Parameter 1 <INPUT TYPE="CHECKBOX" NAME="par2" VALUE="true"> Parameter 2 <INPUT TYPE="BUTTON" NAME="senden" VALUE="aktualisieren"> </FORM> ); if ($cgih->param('senden')) { # verarbeite Parameter } else { # sonst Formular ausgeben print $cgih->header, $formular; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
use CGI; my $cgih = CGI->new; my $par1 = $cgih->param('par1'); my $par2 = $cgih->param('par2'); my $formular = qq( <FORM> <INPUT TYPE="CHECKBOX" NAME="par1" VALUE="true"> Parameter 1 <INPUT TYPE="CHECKBOX" NAME="par2" VALUE="true"> Parameter 2 <INPUT TYPE="BUTTON" NAME="senden" VALUE="aktualisieren"> </FORM> ); print $cgih->header; if ($cgih->param('senden')) { # verarbeite Parameter } # Formular ausgeben print $formular;
if ($cgih->param('senden')) { ...
<INPUT TYPE="SUBMIT" NAME="senden" VALUE="aktualisieren">
<FORM>
<FORM method="POST">
2013-08-08T11:09:05 GwenDragonDer HTML-Code für den Button muss so lauten, damit er was sendet
2013-08-08T11:57:42 GwenDragonZu Anfang des Threads war es im HTML type="button" da wird aber kein Submit für das Formular erzeugt.