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

I'm not sure if this is a Perl question or a HTML one. I'm pretty sure I'm in the right place because I saw a vague reference in the perldoc that might have had something to do with it. (Can't find it now though - 2 minutes later.)
I've had to format some buttons on a page to each be in their own form to keep IE happy. The problem is that somehow I've got a carriage return in after each form. Instead of a tidy set of buttons at the top of the page I get a vertical list of them.
The code for the buttons is:
# Set Up Buttons print "<div align='center'>"; my $i = 0; while (@record[$i]){ print "<form action='/cgi-bin/subcatredir.cgi' method='get'>"; + print "<button type='submit' name='butCat' class=' +sub' value='@recordnum[$i]'><b>@record[$i]</b></button>"; + print "</form>&nbsp;"; $i=$i+1; } print "<input type='text' name='txtTyp' size='1' class='hi +dden' value='bus'/>"; print "</div>";
@record and @recordnum were populated by a database query earlier in the script.
The page is at www.martoncentral.co.nz/buslst.html and it is the second row/column of buttons involved.
I tried putting the buttons in a table but ended up with a row that cut clean across the right hand column. I'm lost. Any ideas what I've done wrong here?
Thanks.

Replies are listed 'Best First'.
Re: Removing auto formatting at end of forms
by cLive ;-) (Prior) on Nov 14, 2006 at 02:56 UTC
    Edit your CSS:
    form { display: inline; }
      Thanks cLive,
      I guess it wasn't a Perl question after all.
Re: Removing auto formatting at end of forms
by osunderdog (Deacon) on Nov 14, 2006 at 02:59 UTC

    well, several things... may or may not have anything to do with the problem you are seeing with IE.

    • Everyone highly recommends using CGI rather than rolling your own HTML.
    • You're referencing @recordnum[$i] and @record[$i]. However I think you probably should be doing:
      use strict; my $i = 1; my @recordnum = ('this', 'that', 'those'); my @record = (1, 2, 3, 4); print "<button type='submit' name='butCat' class='sub' value='$recordn +um[$i]'><b>$record[$i]</b></button>";
    • Finally, I'm certainly not a HTML guru, but I would probably mess with spacing using a class and a CSS.

    Hazah! I'm Employed!

      Everyone highly recommends using CGI rather than rolling your own HTML

      Not quite. Everyone recommends using CGI (or it's cousin) for parsing CGI input, not rolling HTML. In fact you'd be hard pressed to find someone who recommends CGI's html functions. Most people I know of recommend a templating system like Template::Toolkit or HTML::Template.

      grep
      XP matters not. Look at me. Judge me by my XP, do you?

      osunderdog,
      I must confess I am lost by your comment about using CGI - I thought I was. I guess it's back to the drawing board (or documentation).
      Thanks for the input.