LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 04-03-2007, 08:21 AM   #1
adam_blackice
Member
 
Registered: Apr 2006
Location: /*Egypt */ //cairo
Distribution: Ubuntu 7.04 , SLED 10 , Fedora , RHEL 5
Posts: 312

Rep: Reputation: 32
why this simple cgi script doesnot work ? .


hello all ...,

i started in cgi scripts cuz i need it for an project issue by the way i start to run simple scripts with perl also but i found an error with this simple script
PHP Code:
#!/usr/bin/perl -w
use strict;

print 
"Content-type: text/html\n\n";

print 
"<html><head><title>Our First HTML Perl form</title></head>";
print 
"<body>";
print
"form method='post' action='action.pl'>";

print
"Name: <input type='text' name='name' size='25'><br>";

print
"Email: <input type='text' name='email' size='25'><br>";

print
"<input type='submit' value='Submit'>";

print
"</form>";
print
"</body></html>"
and when i run it by the browser ......

the fields for the user input's appear but also this appears in browser beside it .....

form method='post' action='action.pl'>Name:
Email:

and when i click submit there is nothing happen !!!!!!

However the action1.pl is created also

PHP Code:
#!/usr/bin/perl -w
use strict;
use 
cgi;

my $cgi=new CGI;

print 
$cgi->header();
print 
$cgi->start_html("Action page");
print 
$cgi->param('name'), "<br>";
print 
$cgi->param('email');
print 
$cgi->end_html(); 
what is wrong ...plz help me
 
Old 04-03-2007, 08:56 AM   #2
Guttorm
Senior Member
 
Registered: Dec 2003
Location: Trondheim, Norway
Distribution: Debian and Ubuntu
Posts: 1,453

Rep: Reputation: 446Reputation: 446Reputation: 446Reputation: 446Reputation: 446
The line:
Code:
print"form method='post' action='action.pl'>";
is missing the first "<" character, no?
 
Old 04-03-2007, 02:32 PM   #3
adam_blackice
Member
 
Registered: Apr 2006
Location: /*Egypt */ //cairo
Distribution: Ubuntu 7.04 , SLED 10 , Fedora , RHEL 5
Posts: 312

Original Poster
Rep: Reputation: 32
OOoooOOops i forget that and thanx for you help it works
 
Old 04-03-2007, 10:45 PM   #4
//////
Member
 
Registered: Nov 2005
Location: Land of Linux :: Finland
Distribution: Arch Linux && OpenBSD 7.4 && Pop!_OS && Kali && Qubes-Os
Posts: 824

Rep: Reputation: 350Reputation: 350Reputation: 350Reputation: 350
Hi, I use this kind of start in my cgi's.
It produces cgi-error.log if there is something wrong with it.
Code:
#!/usr/bin/perl
$| = 1;
use CGI;
use CGI::Carp;
BEGIN {
       use CGI::Carp qw(carpout);
       open(LOG, ">>/var/log/cgi-error.log")
            or die "Unable to append to cgi-error.log: $1\n";
       carpout(*LOG);
}
 
Old 04-04-2007, 10:50 AM   #5
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,399
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
In addition to what ////// said, I also like
Code:
use CGI::Carp qw(fatalsToBrowser);
This is convenient during the early testing & debugging period.

--- rod.
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Simple script won't work compused Linux - Newbie 4 11-22-2006 06:52 AM
newbie, getting simple python script to work Monjawi Programming 6 10-03-2005 11:51 AM
Why doesnt my simple html post to cgi script work? ginda Linux - Networking 10 03-15-2005 03:32 PM
#! does not seem to work in cgi-bin?? (script execution) servnov Linux - General 6 12-06-2004 07:23 AM
Sound doesnot work anshulkothari Slackware - Installation 1 02-01-2004 06:46 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:44 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration