Uutiset:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu
Advertisement:

Dropdown appearing multiple times? SOLVED

Aloittaja mickinell, toukokuu 01, 2008, 10:21:47 AP

« edellinen - seuraava »

mickinell

Edit:  I'd delete this if I could.  Caught my mistake.

I cannot figure out what I've done wrong.

Here's the problem.  There are currently three options in my dropdown, so it's displaying THREE dropdowns:

Option One v

Option One v
Option Two

Option One v
Option Two
Option Three

Why is it doing that?  I'm using the same code I've used elsewhere and it hasn't done that!  The relevant code's below.

$result = dbquery("SELECT catid, parentcatid, category, slevel  FROM ".TABLEPREFIX."fanfiction_categories WHERE slevel < 2 AND  parentcatid > -1 ORDER BY parentcatid");
while ($row = mysql_fetch_array($result)) {
$catid = $row['catid'];
$pcat = $row['parentcatid'];
$category = $row['category'];
$slevel = $row['slevel'];
$option_block .= "<option value=\"$catid\">Parent: $pcat -- Category: $category --  Level: $slevel</option>";
$output .= "<FORM METHOD=\"POST\" ACTION=\"admin.php?action=show_editcat\"><P><select name=\"category\">$option_block</select><input type=\"SUBMIT\" NAME=\"submit\" VALUE=\"Edit this category\"></p></form>";
}
Forum version: SMF 2.0 RC2
Installed Modifications:  MCLegendII 1.1, Member Color Link 2.0.5, SMF 1.0.13 / 1.1.5 / 2.0 b3.1 Update

Spaceman-Spiff

You should put $ouput line outside the loop. When you put it inside, what happens is, it prints the form 3 times.

Advertisement: