Adedayo Adeyeye wrote:
Hello,

I'm getting an error when trying to run a script. Part of the scripts is

Line 10 my $action = param('form_action');

 .

 Line 14 Search_DB()  if($action eq 'search');

The error I get is:

[Tue Nov  1 16:28:41 2005] connect_script.cgi: Use of uninitialized value in
string eq at connect_rodopi.cgi line 14.
How am I supposed to initialize this value?

Kind regards

Dayo




Two things you can do:

line 10: my $action = param('form_action') || '';

or

line 14: Search_DB() if( defined( $action ) && $action eq 'search' );

The first solution implies that the value '' for $action will never be tested for. I prefer the second one. You can always put it in its own if statement:

if( defined( $action )){
  # list of actions
  ...
  Search_DB() if $action eq 'search';
  ...
}else{
  # page for no action
  ...
}


--

Just my 0.00000002 million dollars worth,
   --- Shawn

"Probability is now one. Any problems that are left are your own."
   SS Heart of Gold, _The Hitchhiker's Guide to the Galaxy_

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to