I know you figured out the problem, but as a side note, the reason why
"if($datemod = 7)" worked for everything is that you were assigning the
value 7 to the variable $datemod.  If it is successful, then the expression
will return true.  
   I think you must have known this on some level because you already had
statements with the appropriate operator, '=='.  (two equal signs), which
returns true only if the right and left sides are equal numerically.  (note
that 'eq' is the operator to use for strings)

-----Original Message-----
From: Tara Calishain
To: [EMAIL PROTECTED]
Sent: 6/29/02 8:50 PM
Subject: If/Elsif isn't doing what I'd expect

I'm using a script that's getting parameters passed to it via a form. 
Here's the
relevant part of the form:

<select name="datemod">
<option name=0>0 (Today's additions)
<option name=1>1 (Yesterday)
<option name=7>Last Seven Days
<option name=30>Last 30 Days

In the script that's referenced like so:

my $datemod = param('datemod');

At the end of the script I want to open one of three pages depending on
that variable. I tried doing it like this:

if($datemod==7) { print "Location: $fullquery7\n\n";}
elsif($datemod==30) { print "Location: $fullquery30\n\n";}
else {print "Location: $fullquery\n\n";}

The problem is that I must not be pointing to $datemod correctly,
because
the if and elsif NEVER trip. The only way I could get it to trip is by
doing
"if ($datemod=7)" and when I did that EVERYTHING tripped whether it was
7 or
not.

Am I missing something really obvious?

Thanks,

Tara




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to