How about building an array of all the levels: $a = array();
for ($i = 1; $i <= $maxlevels; $i++) $a[] = $i; then for each level you can create a new array that is the difference between the original array and an array that contains the current level: for ($i = 1; $i <= $maxlevels; $i++) $a1 = ; echo '<option value="' . implode ('|', array_diff ($a, array($i))) . '">Level ' . $i; I'm not 100% that this will work right off the bat, but it should at least put you on the right track... if not out of your misery :-) Hope this helps. Marco -- ------------ php|architect - The magazine for PHP Professionals The first monthly worldwide magazine dedicated to PHP programmers Check us out on the web at http://www.phparch.com On Mon, 2002-11-11 at 09:48, Tony Crockford wrote: > 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 > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php