Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Running Perl script in the backend from Html

Reply
Thread Tools

Running Perl script in the backend from Html

 
 
satish2112@gmail.com
Guest
Posts: n/a
 
      09-11-2007
Following is my HTML template:

<html>
<head>
<title>Web page</title>
</head>
<body>
<form method="post" action="script.pl">
<p><textarea cols="20" rows="20" name="field"></textarea></
p>
<p><input type="submit" value="update" ></p>
</form>
</body>
</html>

And the Perl Script script.pl is:

#!/usr/bin/perl
use strict;
use warnings;
use CGI;
use DBI;

my $query = new CGI();
my $Value = $query->param('field');

my $dbh = DBI->connect('server address', 'username','password');
my $sth = $dbh->prepare("UPDATE tablename SET columnname = '$Value'
where condition;");
$sth->execute();
$sth->finish();
$dbh->disconnect;


if i click on the submit button, another webpage is opened and the
perl script is executed.
is there any way so that the perl script runs in the backend? ( so
that another webpage doesnt pop-up). how can i modify the above html
code in order to run the perl script in the backend?

 
Reply With Quote
 
 
 
 
Gunnar Hjalmarsson
Guest
Posts: n/a
 
      09-11-2007
wrote:
> Following is my HTML template:
>
> <html>
> <head>
> <title>Web page</title>
> </head>
> <body>
> <form method="post" action="script.pl">
> <p><textarea cols="20" rows="20" name="field"></textarea></
> p>
> <p><input type="submit" value="update" ></p>
> </form>
> </body>
> </html>
>
> And the Perl Script script.pl is:
>
> #!/usr/bin/perl
> use strict;
> use warnings;
> use CGI;
> use DBI;
>
> my $query = new CGI();
> my $Value = $query->param('field');
>
> my $dbh = DBI->connect('server address', 'username','password');
> my $sth = $dbh->prepare("UPDATE tablename SET columnname = '$Value'
> where condition;");
> $sth->execute();
> $sth->finish();
> $dbh->disconnect;
>
>
> if i click on the submit button, another webpage is opened and the
> perl script is executed.
> is there any way so that the perl script runs in the backend? ( so
> that another webpage doesnt pop-up). how can i modify the above html
> code in order to run the perl script in the backend?


print $query->header(-status=>'204 No Content');

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
 
Reply With Quote
 
 
 
Reply

Thread Tools

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

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Trouble running Perl script from within a Perl script laredotornado@zipmail.com Perl Misc 4 07-29-2011 01:44 PM
Running Perl script in the backend from Html satish2112@gmail.com Perl Misc 2 09-17-2007 08:23 PM
Running Perl script in the backend from Html satish2112@gmail.com Javascript 1 09-11-2007 09:24 PM
Simple task works when MS SQL Server is the backend but not when MySQL is the backend. Ted ASP .Net 1 02-22-2007 08:33 PM
Perl Help - Windows Perl script accessing a Unix perl Script dpackwood Perl 3 09-30-2003 02:56 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57