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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

exists error

Status
Not open for further replies.

tonyjob

Programmer
Nov 20, 2000
25
0
0
GB
i get an error with this code:

if (exists param('name')){
}else{
}

it says that the condition in exists may be a hash, but it isnt. and this works:

$name=param('name');

so why doesnt the is statement?



~Tony
 
'exists' checks to see if a hash's key exists.
Use 'defined' to check if something else exists.
[tt]
if (defined param('name')){
}else{
}
[/tt] "If you think you're too small to make a difference, try spending a night in a closed tent with a mosquito."
 
Unless null and/or 0 and/or '0' are valid values, it's easier just to say:
Code:
if ( $param{'name'} )
It the variable has any value other than null, zero or '0' it will be true.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top