#!/usr/bin/perl -w use strict; use CGI; use CGI::Carp qw(fatalsToBrowser); use vars qw($Query $Query2 $dbh $sth $Value $Data1 $Data2); my @results; my @row; use DBI; $Query = new CGI( ); $dbh = DBI->connect("DBI:mysql:exelstock") or die "Cannot connect: " . $DBI::errstr; $Data1 = $Query->param('Value4'); $Data2 = $Query->param('Value5'); $sth = $dbh->prepare("INSERT INTO walstock (sid, name, qty) VALUES (DEFAULT, $Data1, $Data2)"); $sth->execute(); print "Content-type: text/html\n\n"; print "\n"; print "\n"; print "Insert Records\n"; $sth = $dbh->prepare("SELECT * FROM walstock WHERE name='$Data1'"); $sth->execute(); while (@row = $sth->fetchrow_array) { print "@row\n"; } $sth = $sth->finish(); $dbh->disconnect(); print "\n"; print "\n";