Find the answer to your Linux question:
Results 1 to 3 of 3
I am working on perlCGI script and want to display the data on the same page on click of Add button. print "<table>\n"; print "<tr><td>$curr_date</td><td><input type=\"text\" name=\"uid\"></td><td><input type=\"text\" name=\"bltest\"></td><td><input type=\"text\" ...
  1. #1
    Just Joined!
    Join Date
    Apr 2008
    Posts
    19

    How to display data on same page in perlCGI

    I am working on perlCGI script and want to display the data on the same page on click of Add button.

    print "<table>\n";
    print "<tr><td>$curr_date</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 "</table>\n"

    any suggestion ??

  2. #2
    Linux Newbie
    Join Date
    Mar 2008
    Location
    Hyderabad
    Posts
    109
    if($_GET["var"] == 0)
    {
    // Keep the form table here, use GET method, send form to same page and at the end of the form before the print "</form>"; line add
    print "<input type=\"hidden"\" name=\"var\" value=\"1\">";
    }
    else
    {
    // Display here
    }

  3. #3
    Just Joined!
    Join Date
    Apr 2008
    Posts
    19
    I could not get you, could you please put some more light ......

    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";

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...