Forum Moderators: coopster & phranque

Message Too Old, No Replies

I need to update my forms dynamically

update forms dynamically

         

shaan1980

11:01 pm on Mar 17, 2004 (gmt 0)

10+ Year Member



I want to update my form dynamically from my database
i wrote a script here that doesn't work any thoughts
#!/usr/local/bin/perl -w

print "Content-type: text/html\n\n";

use CGI;
use File::Copy;
use CGI qw(:standard);
use DBI;
$dbname = '%%%%%';
$user = '%%%%%%';
$passwd = '%%%%%';
$dbh = DBI->connect($dbname, $user, $passwd, 'Oracle');

my $sth1=$dbh->prepare('SELECT * FROM school');

$sth1->execute() or die "USERNAME DOES NOT EXIST " . $sth->errstr;
$sth1->bind_columns(\$schoolname);
print<<HTML;
<html>
<head>
<title>New Page 1</title>
</head>
<body>
<form method='POST'>
<p>
<select size='1' name='D1'>

while($sth1->fetch())
{
print ("<option>$schoolname</option>");
}

</select></p>
</form>
</body>
</html>
HTML

flashfan

4:48 am on Mar 22, 2004 (gmt 0)

10+ Year Member



You should move the while loop out of <<HTML...HTML