Results 1 to 1 of 1
I am a beginner and working on perlCGI, facing following problem
I am fetching some data from DB and displaying that into the HTML tabular format but now I need ...
- 05-14-2008 #1Just Joined!
- Join Date
- Apr 2008
- Posts
- 19
How to delete selected row (HTML table) from DB using PerlCGI?
I am a beginner and working on perlCGI, facing following problem
I am fetching some data from DB and displaying that into the HTML tabular format but now I need to provide a facility to delete selected (in HTML) row from DB. Don't know is it possible in PerlCGI.
(And also in the same table I am need to give the facility to add Data in to the DB and it should show on the same page even after adding the new data. page should not change)
Please help/suggestion or provide any link
Following is my code:-
print "<html>\n";
print "<head><TITLE>Comment</TITLE></HEAD>\n";
print "<table valign=top align=center>\n";
print "<tr><td valign=top>\n";
print "<table border=2 cellpadding=3px>\n";
print "<tr><th bgcolor=$color_h1 colspan=7 align=left>Comment</th></tr>\n";
print "<tr><th bgcolor=$color_h2 colspan=1>Date</th><th bgcolor=$color_h2 colspan=1>Server</th><th bgcolor=$color_h2 colspan=1>UserID</th><th bgcolor=$color_h2 colspan=1>BLTest</th><th bgcolor=$color_h2 colspan=1>Comment</th><th bgcolor=$color_h2 colspan=2>Action</th></tr>\n";
print "<tr><td>$curr_date</td><td><input type=\"text\" name=\"node\"></td><td><input type=\"text\" name=\"uid\"></td><td><input type=\"text\" name=\"bltest\"></td><td><input type=\"text\" name=\"comment\"></td><td><input type=\"submit\" value=\"ADD\"></td><td><input type=\"submit\" value=\"DEL\"></td></tr>\n";
print "<tr><td>\n";
my $sql="SELECT * FROM comp_comment";
my $sth=$dbh->prepare($sql) or die "Error: Cannot prepare: ";
$sth->execute() or die "Error: Cannot execute: ";
my $row_count=$sth->rows;
my $comment;
if ($row_count != 0) {
while (my $row=$sth->fetchrow_arrayref){
$comment->{@$row[0]}->{@$row[1]}->{@$row[2]}->{@$row[3]}->{@$row[4]}->{@$row[5]}="";
\n";
}
}
print "</table>\n";
print "</td></tr>\n";
print "</table>\n";
print "<hr>\n";


Reply With Quote