Hi thanks for the above unforyunately it didnt work apache gave an error about no end of line on line 28 after the print "$output"; the code I had done a copy and paste on and could not see any error that way ant taught appreciated this shouls be an easy task the code I am working from now is below.Ive just added the action tag which I dont think you should need from your code.
#!/usr/bin/perl -w
## connect to database and add contents from webpage simple example
print "Content-type: text/html\n\n";
use DBI;
$database="sports";
$uname="sports";
$pwd="marathon";
$dbh=DBI->connect("DBI:mys
#connect to the database
#enter your database name ,username and password to the connection string.
$sth = $dbh->prepare("SELECT league_description FROM LEAGUE ");
$sth->execute;
#execute your query
my (@telephone);
my $i = 0;
my $count;
while (@aRow = $sth->fetchrow())
{
$telephone[$i] =@aRow[0];
print ("\n");
print" $telephone[$i]";
$i++;
}
$thisprog = "loop.cgi";
print "<html><head><title>show table</title></head><body bgcolor=#C0C0C0> <form action="$thisprog" method=post><select><optio
$sth->finish();
$dbh->disconnect();
Main Topics
Browse All Topics





by: DingDangPosted on 2004-02-17 at 22:36:38ID: 10389889
You can try use this :
atabase",$ uname,$pwd ");
>$particip ant_lname
#!/usr/local/bin/perl
print "Content-type: text/html\n\n";
use CGI;
use DBI;
$query = new CGI;
$thisprog = "myprogram.cgi"; # change this accordingly
$database="sports";
$uname="sports";
$pwd="marathon";
$dbh= DBI->connect("DBI:mysql:$d
$sql =qq~
SELECT participant_lname FROM PARTICIPANT
~;
$sth = $dbh->prepare($sql);
$sth->execute() or error("SQL","Couldn't execute statement: $DBI::errstr");
while (($participant_lname) = $sth->fetchrow_array()) {
$myoutput .=qq~
<option value="$participant_lname"
~;
}
$output.=qq~
<form action="$thisprog" method=post>
<B>Participant Lname</B>
<select name="id">
$myoutput
</select>
</form>
~;
print "$output";