Logic headache, please help.
| From: | Tony Crockford | Date: | Mon, 11 Nov 2002 14:48:19 +0000 |
| Subject: | Logic headache, please help. | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-123813@lists.php.net to get a copy of this message | ||
Hi all,
brief explanation:
I'm building a select list, to exclude certain directories from a search
(with Ht://dig).
The structure is like this:
<select name="exclude">
<option value="">All levels</option>
<option value="/lv2/|/lv3/|/lv4/">Level 1</option>
<option value="/lv1/|/lv3/|/lv4/">Level 2</option>
<option value="/lv1/|/lv2/|/lv4/">Level 3</option>
<option value="/lv1/|/lv2/|/lv3/">Level 4</option>
</select>
for four levels, where the option value should be all lv's except the
current option level.
I have a variable $maxlevels to count up to however many levels are
required and I want to make this select list work based on the value of
$maxlevels.
How would you approach the building of the list?
I was going to use a while loop or two, but I'm stuck at the point of
creating the value "string" which should contain all the levels from 1
to $maxlevels except the current level. which would seem to require some
sort of conditional "if $thislevel string is" type of approach, but I
can't get my head round it.
Anyone put me out of my misery?
Thanks
Tony