Thread Save.pl Speichert nicht mehr ab !! (15 answers)
Opened by Gast at 2004-05-03 16:52

Ronnie
 2004-05-03 20:43
#2340 #2340
User since
2003-08-14
2022 Artikel
BenutzerIn
[default_avatar]
Du solltest Inhalt und Darstellung mit CSS sauberer trennen. Das ganze mal inhaltlich vereinfacht:
Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
<form id="theForm" action="/cgi-bin/save.pl" method=post">
<input type="submit" value="save" />
 <input name="Name"      type="text" width=40 size="20" />
 <input name="Firstname" type="text" width=40 />
 <input name="Street"    type="text" width=40 />
 <input name="Nr"        type="text" width=40 size="5" />
 <input name="Code"      type="text" width=40 size="5" />
 <input name="City"      type="text" width=40 />
 <input name="Tel"       type="text" width=40 />
 <input name="Email"     type="text" width=40 />
</form>

Und hier der angepasste und gesäuberte Code:
Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/perl

use strict;
use warnings;
use CGI;
use CGI::Carp qw(fatalsToBrowser warningsToBrowser);

my $q = new CGI;
my $name        = $q->param("Name")         || '';
my $firstname   = $q->param("Firstname")    || '';
my $street      = $q->param("Street")       || '';
my $nr          = $q->param("Nr")           || '';
my $code        = $q->param("Code")         || '';
my $city        = $q->param("City")         || '';
my $tel         = $q->param("Tel")          || '';
my $email       = $q->param("Email")        || '';

open(COMMENTS, ">>data.txt")
 or die "Open data.txt for concat failed: $!";

print COMMENTS join("|", ($name, $firstname, $street, $nr,
                         $code, $city, $tel, $email)), "\n";

close (COMMENTS);

#
# ouput to browser
#

print $q->header,
     $q->start_html('visualVIBES bioNET'),
     $q->h1('Your entry has been saved'),
     $q->hr,
     $q->end_html, "\n";

View full thread Save.pl Speichert nicht mehr ab !!