Hi I have a CGI/dbi script which whenever the page is reloaded the following executes
print start_multipart_form (POST); print "Subject", popup_menu(-name=>'Subject1',-values=>[EMAIL PROTECTED]); print "Area", popup_menu(-name=>'area1',-values=>[EMAIL PROTECTED]),p; print "Description",textfield(-name=>'file_desc',-size=>'50'); $subj1=param('Subject1'); $area1=param('area1'); $desc=param('file_desc'); #print $subj1; #$subj2=param('Subject1'); #$area2=param('area1'); $row3=$dbh->prepare("SELECT subj_id FROM tb_file_subj WHERE subj_desc = ?"); $row4=$dbh->prepare("SELECT area_id FROM tb_file_area WHERE area_desc = ?"); $row3->bind_param(1,$subj1); $row4->bind_param(1,$area1); $row3->execute(); $row4->execute(); while (($subj2) = $row3->fetchrow_array()){ $subj3=$subj2; } print $subj3; while (($area2) = $row4->fetchrow_array()){ $area3=$area2; } print $area3; $sth=$dbh->prepare(q{INSERT INTO tb_files (subj, area, file_no, file_desc) select ?, ?,(SELECT coalesce(max(file_no),0)+1 FROM tb_files WHERE subj = ? AND area = ?),?}) ; $sth->bind_param(1,$subj3); $sth->bind_param(2,$area3); $sth->bind_param(3,$subj3); $sth->bind_param(4,$area3); $sth->bind_param(5,$desc); $sth->execute ; print p; if($DBI::errstr ne ''){ print "$DBI::errstr\n"; } print p; print submit; print end_form; This is not I want - I only want it to execute when I click submit - is this possible? Curioisly, when I click refresh, the values dont reset -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>