if( $_GET) if else problem
Posted
by webdev
on Stack Overflow
See other posts from Stack Overflow
or by webdev
Published on 2010-05-22T09:31:40Z
Indexed on
2010/05/22
9:40 UTC
Read the original article
Hit count: 114
php
need help...
the getting input form:
<select name="age">
<option value="25-30">25-30</option>
<option value="31-40">31-40</option>
<option value="41-50">41-50</option>
<option value="51-60">51-60</option>
</select>
example url
search/?age=25-30
the function php:
if ( $_GET['age'] !="25-30") $age = '("A")';
elseif ( $_GET['age'] !="31-40") $age = '("B")';
elseif ( $_GET['age'] !="41-50") $age = '("C")';
elseif ( $_GET['age'] !="51-60") $age = '("D")';
else ( $_GET['age'] !="25-30") $age = '("A")';
$search ="http://domain.com/?q='.$age;
the problem: the $age inside $search always returns A (or 25-30) even though i have selected other values (31-40, 41-50, 51-60)
please help..thanks
© Stack Overflow or respective owner