Thread Hinzufügen von Spalten in einer Tabelle (105 answers)
Opened by piero at 2004-04-26 12:59

piero
 2004-05-12 18:50
#2262 #2262
User since
2004-03-03
98 Artikel
BenutzerIn
[default_avatar]
Hallo,
der Fehler tritt jetzt nicht mehr auf, nur bekomme ich keine E-Mail.

Ich kommt der gesammte 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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#! /usr/bin/perl -w  
use MIME::Base64;
use strict;
use warnings;
use diagnostics;
use CGI;
use CGI::Carp qw(fatalsToBrowser);
use lib qw(.);
use Mail::Sendmail;
#use FindBin();
#use lib $FindBin::Bin;
use HTML::Template;
use HTML::Entities;


my $cgi = CGI->new();
my %params = $cgi->Vars();
print $cgi->header(-type => 'text/html');
                                                                               
my $template = HTML::Template->new(filename =>  '/home/webmaster/docs/deutsch/Bedarfsmeldung/bedarfsmeldung2.htm');
                                                                               
if($params{add}){ # wenn artikel hinzugefügt werden soll
my @loop = ();
if($params{alt}){
my @artikel = split(/;/,$params{alt});
foreach(@artikel){
 my ($art_name,$stueck,$euro) = split(/#/,$_);
 push(@loop,{ARTIKEL => $art_name, STUECK => $stueck, EURO => $euro});
}                                                                              
}                                                                              
push(@loop,{ARTIKEL => $params{ARTIKEL}, STUECK => $params{STUECK}, EURO => $params{EURO}});
my $alte = $params{alt}.";$params{ARTIKEL}#$params{STUECK}#$params{EURO}";
$template->param(ALT => $alte,
                    ARTIKELLISTE => \@loop,
                    ABTEILUNG => $params{ABTEILUNG},
                    KOSTENSTELLE => $params{KOSTENSTELLE},
                    DATUM => $params{DATUM},
                    BENUTZER => $params{BENUTZER});
}                                                                              
                                                                               
elsif($params{submit}){                                                      
#require Mail::Sendmail;                                                    
#my $sendmail = '/usr/sbin/sendmail -t';                                    
my $sender = 'Piero <gior\@imap.de>';
my $empfaenger = 'Du <gior\@imap>';
my $betreff = 'Artikelliste';
my $body = qq~<table><tr><td>Benutzer</td><td>$params{BENUTZER}</td></tr>    
<tr><td>Abteilung</td><td>$params{ABTEILUNG}</td></tr>                      
<tr><td>Kostenstelle</td><td>$params{KOSTENSTELLE}</td></tr>                
<tr><td>Datum</td><td>$params{DATUM}</td></tr></table>                      
~;                                                                          
$body='<table border="1"><th>Artikel</th><th>Stueck</th><th>Preis</th>';    
my @artikel = split(/;/,$params{alt});
foreach(@artikel){                                                          
my ($art,$st,$eur) = split(/#/,$_); $body .= '<tr><td>'.$art.'</td><td>'.$st.'</td><td>'.$eur.'</td></tr>';    
}                                                                            
$body .= '</table>';                                                        
                                                                           
my %mailer_options = (                                                      
'Content-Type' => 'text/html; charset="iso-8859-1"',
To => $empfaenger,
From => $sender,
Subject => $betreff,                                      
Message => $body,                                        
);                                                        
Mail::Sendmail::sendmail(%mailer_options);                
                                                         
                                                         
#open(MAIL,"| $sendmail") or print $!;                    
#print MAIL "To: $empfaenger\n";                          
#print MAIL "From: $sender\n";                            
#print MAIL "Subject: $betreff\n\n";                      
#print MAIL $body;                                        
#close MAIL;                                              
$template->param(MESSAGE => 'E-Mail wurde abgeschickt');  
}                                                        
print $template->output();                                


Vielen Dank.\n\n

<!--EDIT|renee|1084445513-->

View full thread Hinzufügen von Spalten in einer Tabelle