Welcome to Linux Forums!

With a comprehensive Linux Forum, information on various types of Linux software and many Linux Reviews articles, we have all the knowledge you need a click away, or accessible via our knowledgeable members.

Linux Forum ArticlesLinux ForumsLinux Forum DownloadsLinux Hosts
Home|Register|FAQ|Member List|Calendar|Unanswered Posts|Forum Rules|Today's Posts|Advanced Search|
SEARCH FOR IN
Go Back   Linux Forums > GNU Linux Zone > Linux Programming & Scripting
Reload this Page How to display data on same page in perlCGI
Linux Forums
Linux Forums
Welcome To The Linux Forums!
Welcome to Linux Forums. We pride ourselves in being one of the largest Linux communities on the web, we encourage you to REGISTER on our forums and participate in the community. There are over 150,000 members ready to answer your questions. JOINING US today will allow you to make new posts, get support, send messages to other members and submit downloads to our downloads directory and many other great features!

Linux Programming & Scripting C, Perl, PHP, Bash Scripts, anything programming or script related post in here!

Reply
 
Thread Tools Display Modes
Old 05-13-2008   #1 (permalink)
shorye
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 ??
shorye is offline   Reply With Quote
Old 05-14-2008   #2 (permalink)
digvijay.gahlot
Just Joined!
 
Join Date: Mar 2008
Location: Hyderabad
Posts: 88
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
}
digvijay.gahlot is offline   Reply With Quote
Old 05-14-2008   #3 (permalink)
shorye
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";
shorye is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


All times are GMT. The time now is 10:57 PM.

Powered by vBulletin 3.6.8 ©2000 - 2007, content relevant URLs by vBSEO, Property of Core Root.

Content Relevant URLs by vBSEO 3.0.0