LinuxQuestions.org
Review your favorite Linux distribution.
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 03-23-2010, 03:55 PM   #1
shifter
Member
 
Registered: May 2006
Distribution: Slackware, DragonFly
Posts: 233

Rep: Reputation: 30
problem in cgi script


I have the following HTML code:
Quote:
<form action="/cgi-bin/script.cgi" method="POST">
<fieldset>
<legend>search for</legend>
<select name="option">
<option value="opt1">opt1</option>
<option value="opt2">opt2</option>
<option value="opt3">opt3</option>
</select>
<input type="text" name="search">
<input type="submit" value="search"><br/>
</fieldset>
</form><br/><br/>
and script.cgi:
Quote:
#!/usr/bin/perl

use CGI;
use Template;

my $cgi = CGI->new();
print $cgi->header('text/html');
my $option = $cgi->param('option');
my $search = $cgi->search('search');

print $option;
print $search;
the output is a beautiful white page.

Where is the problem?
 
Old 03-23-2010, 04:52 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
There's a good chance you'll learn about it in your HTTP servers error log...

Also, for cgi even more than usual, it makes sense to use -w PLUS -T
 
Old 03-24-2010, 01:46 PM   #3
CoderMan
Member
 
Registered: Jan 2009
Location: Gemini Capsule 25164
Distribution: Gentoo
Posts: 375
Blog Entries: 24

Rep: Reputation: 43
Quote:
Originally Posted by shifter View Post
I have the following HTML code:


and script.cgi:


the output is a beautiful white page.

Where is the problem?
My Perl CGI is getting a bit rusty. But last time I checked "search" was not a method of the CGI class. I think you simply meant to get another parameter.

Also you do not have body tags in you HTML output.
 
Old 03-24-2010, 06:15 PM   #4
shifter
Member
 
Registered: May 2006
Distribution: Slackware, DragonFly
Posts: 233

Original Poster
Rep: Reputation: 30
In fact, after I used $cgi->param.

In any case, thank you for answer.
 
  


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
ampersand problem in cgi script... Sherlock Programming 1 05-22-2007 07:42 AM
sendmail and cgi script problem snapperhead Linux - Networking 0 02-13-2007 12:10 PM
CGI-Script Problem shipon_97 Linux - Newbie 1 05-09-2006 02:30 AM
CGI-script problem on Apache2 jkt2000 Linux - Networking 3 01-28-2005 04:38 AM
Apache cgi-script problem palanisaravanan Linux - General 6 02-07-2004 09:41 AM

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

All times are GMT -5. The time now is 08:37 PM.

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