Hi all

The following script displays a overwiev from a addresslist with links to
the details of each entry. With an iteration I create the no. of each row
that is being handed over to details.cgi. It all works perfectly well apart
from the fact that the html links that get displayed all have got the same
name. I'm getting the value from the first row of the array that has been
defined in $rows[0]. The iteration works fine though.

Immagine the following list:

wayne;john;huston
cooper;cary;seattle
bergman;ingrid;stockholm

The result I'm getting is:

wayne (link for wayne)
wayne (link for cooper)
wayne (link for bergman)

I asume, I should change the way I combined the while and for functions or
this combination isn't possible at all or I cannot work with $rows twice
within the while-function?

Thanks for any help
Richard (from rainy switzerland)

#!c:/program files/perl/bin/perl -w

use diagnostics;
use strict;
use CGI;
use CGI::Carp qw(fatalsToBrowser);
use CGI 'escapeHTML';


my $q = CGI::new();                     # create new object

print    $q->header('text/html'),
            $q->start_html(-title=>'addresslist',
                                   -bgcolor=>'white'),
          $q->h1('titel h1'),
          $q->p('this is the list:');

open(ADDRESSLIST,"<adressliste.csv") or die "cannot read list: $!\n";

while (<ADDRESSLIST>) {
                                               my @rows= split (/;/);
                                               for my $i (0 ..$#rows) {

print $q->a({href=> "/cgi-bin/details.cgi?nr=$i"},

escapeHTML($rows[0]))."<br>\n"; } close ADDRESSLIST;
                                                                            
         }
print $q->end_html;
exit;



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to