Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Perl Beginners Cgi > Odd select box ...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 6 Topic 1394 of 1496
Post > Topic >>

Odd select box behaviour

by aneely@[EMAIL PROTECTED] May 1, 2007 at 08:21 PM

This one has me stumped, and it shouldn't.

I'm trying to validate data from a simple select box:

<select size="1" name="country">
<option selected value='United States'>United States</option>
<option value='Canada'>Canada</option>
</select>

When I do:

foreach my $Item (param())
{
	my $input=param($Item);
	print "$Item  --$input--<br>\n";
}

the data is printed out with the expected leading and trailing '--'.

But when I try to validate the incoming data:

my $Country=param('country');
if ($Country ne 'Canada' || $Country ne 'United States')
{
   $Status=1;
   $ErrMsg .= "$Mandatory{country} must be either Canada or United
States.<br>";
}

it *always* falls through into the code block.

I've stripped leading and trailing spaces from $Country. I've chomped 
$Country.

This is driving me crazy, especially since there are only 2 choices in 
the select list, and one of them is already selected.

Am I missing something really stupid here?
 




 6 Posts in Topic:
Odd select box behaviour
aneely@[EMAIL PROTECTED]   2007-05-01 20:21:40 
Re: Odd select box behaviour
jon.mangin@[EMAIL PROTECT  2007-05-02 09:51:45 
Re: Odd select box behaviour
jon.mangin@[EMAIL PROTECT  2007-05-02 09:59:41 
Re: Odd select box behaviour
shawn@[EMAIL PROTECTED]   2007-05-02 14:47:12 
Re: Odd select box behaviour
aneely@[EMAIL PROTECTED]   2007-05-02 12:47:10 
Re: Odd select box behaviour
shawn@[EMAIL PROTECTED]   2007-05-03 02:38:39 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Nov 22 11:02:48 CST 2008.