petre has asked for the wisdom of the Perl Monks concerning the following question:

I have a question on how to properly format these dynamic radio buttons. The radio buttons carry all the way to the end of the line but the problem is that the button itself is on the first line but the content of the button is moved to the next line. Can someone please help me out and provide me with some advice on how to resolve this issue. Thank you
sub getThemes { open (H,"themes.dat") || die "didn't work: $!\n"; $i=1; while (<H>) { chop; ($THEMES[$i],$TITLES[$i],$CHECKED[$i]) = split(/!/,$_); $THEMES_RADIOS .= "<INPUT TYPE=RADIO NAME=theme $CHECKED[$i] VAL +UE=$i " . "onClick=\"swapImage('$IMAGEDIR/$THEMES[$i]'); +\"> $TITLES[$i] \n;" $i++; } close (H); }
Thank You

Replies are listed 'Best First'.
Re: Radio Buttons not display properly
by saintbrie (Scribe) on Apr 23, 2004 at 00:54 UTC

    Not really a perl question, is it?

    Try adding an non-breaking space between the input tag and the $TITLES.
     
    ...\">&nbsp;$TITLES[$I]

      Thank You For your insight!
Re: Radio Buttons not display properly
by perlinux (Deacon) on Apr 23, 2004 at 09:39 UTC
    This is not a Perl-problem, but...
    It's important to quote any value of attributes in HTML
    So, try this:
    $THEMES_RADIOS .= "<INPUT TYPE=\"RADIO\" NAME=\"theme\" $CHECKED[$i] V +ALUE=\"$i\" . ....
    and so on....
    The attribute CHECKED is XML-compatible in this form:

    checked="checked"
      Thank You For Your InSight!