Can't do it this way. The || will cast the string returned from param to a boolean. As other monks have pointed out do
if( (length(param('tele')) > 0) ||
(length(param('mobile')) > 0) ) {
}
However your logic doesn't match your error message - if you want to verify that the user has entered only one of the above you'll want to use
&& and if you want to make sure that they have entered at least one you'll want to warn when both tele and mobile are empty, i.e. length = 0 (although as pointed out before I would use
defined to make sure the values aren't null).
You probably want to catch that just whitespace isn't being returned too...
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.