logo       
Google Custom Search
    AddThis Social Bookmark Button

Re: If/Elsif isn't doing what I'd expect: msg#01862

Subject: Re: 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


Haha.... so you.... made a very serious HTML mistake,  ; - )
inside 'option' you should write as
<option value=whatever>opt name</option>
but neither <option name=1>1 (Yesterday)
nor <option name=1>1 (Yesterday) </option>



>
> 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

So I really wonder what's the value you of "datemod" in your form,
perhaps, undef, or blank. and in your code, that is the "else" case so,
it would probrable become "location:fullquery\n\n" all the time ,
that's why if and elsif NEVER run =)


> "if ($datemod=7)" and when I did that EVERYTHING tripped whether it was 7
or
> not.

What this doing is assing 7 for $datemod, and ask if this is true ( not 0 or
blank ),
of cause, that is true. but that's not relat to your case anyway

Hope this help,
Smiley Connie =)



Try Searching:
servers, voip, java, networking, microsoft ...
<Prev in Thread] Current Thread [Next in Thread>