Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

undefined value error - but why?!!?

Status
Not open for further replies.

groovygarden

Programmer
Aug 23, 2001
63
When I submit the form I have created I get the following error:

Can't call method "param" on an undefined value at
path\cgi-bin\timeresults.pl line 3.


refering to the following line:

$q = new CGI

$search_time= $q->param('thetime');


Is it complaining about the value "thetime"? In the form this value is defined like so:

<SELECT NAME =&quot;thetime&quot; SIZE=1>
<OPTION >--Select a time-->


Can anyone tell me what I'm doing wrong. I've used more or less the same code on a form with TEXT input and it works fine. Am very confused and any help would be much appreciated.

Thanks,
 
The complaint you are getting means that the variable '$q' does not exist yet, at least not in an object context. Since that is happening on line 3, I might be able to guess at what your code should look like.

#!/usr/local/bin/perl
use CGI;
my $q = new CGI;
$search_time = $q->param('thetime');
print $q->header;
print $q->start_html;
print &quot;<p>search time was $search_time</p>\n&quot;;
print $q->end_html;



'Hope that helps.





keep the rudder amid ship and beware the odd typo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top