Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Well, there's a few things I noticed that are missing from your example, which may or may not be present in your actual code. And I hate to assume :-)

Are there end tags for your SELECT and FORM tags after your while loop that you have in there?

As for things that may certainly be breaking it -- the OPTION tags within your SELECT statement do not require end tags.. and I'm not sure, but end tags may actually break them. Unless thats part of the new XHTML thing...

Additionally, you may find that not printing out HTML code by hand is a good thing. While perhaps a few small lines may be acceptable, you appear to be using enough HTML to warrant using CGI, which can assist you with any of those HTML coding issues anyway. However, I sometimes find that certain projects are better off using an HTML Templating scheme such as HTML::Template and Template::Toolkit.

Lastly, you may want to consider trying fetchrow_arrayref(), which won't yank all the results into a single array. You can then use it like this:
while (my $row = $sth->fetchrow_arrayref()) { ## Make our HTML look better if no data. $oid = "&nbsp;" if($oid eq ""); $date = "&nbsp;" if($date eq ""); $username = "&nbsp;" if($username eq ""); print <<HTML; <OPTION>$row->[0] $row->[1] $row->[2] HTML }
This example, of course, isn't incorporating CGI, which would again probably be a good idea. And you did define earlier in your code, using "my", your $oid, $date, and $username variables, right? :-)

But if none of that does the trick, perhaps you could be more specific about how things aren't working for you, and what it is that is happening. Good luck!
-Eric


Updated various stuff

In reply to Re: Trying to add objects in dropdown by andreychek
in thread Trying to add objects in dropdown by nlafferty

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (2)
As of 2024-04-20 04:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found