my @files = glob "$ENV{'DOCUMENT_ROOT'}/data/text/*.txt"; my @display_files = map m{([^/]+)\.txt}, @files; Encode::from_to($_, 'ISO-8859-7', 'utf8') for @display_files; if ( param('select') ) { #If User selected an item from the drop do +wn menu unless ( grep { $_ eq param('select') } @display_files ) #If User Selection doesn't match one of the passages then its a F +raud! { ...
Even if the user selects something valid from the drop down menu he is getting the backward error.....on every selection he makes.

In order to get into the error-report block, it must be the case that the string coming from the drop-down menu does not match any of the file name strings you have extracted from your "data/text" directory.

You didn't show us the code that creates the drop-down menu, and it looks like you haven't tried yet to look at the actual string value that is coming in via the "select" param. You need to see what sort of value is coming in, and then figure out why the values in the drop-down menu don't match the file names in that directory.

You should be using exactly one array to populate the options in the drop-down menu and to check the value of param('select'). Create that list only once, and use the one list for both building the form and checking the submission.

(updated to fix grammar in last paragraph)

Another update: if I understand this part correctly:

i noticed on the url that when i submit my selection it looks like this:
http://nikos.no-ip.org/cgi-bin/index.pl?select=item_from_drop_down_menu&ok=ok

I'm guessing the code that creates the drop-down menu is doing something very wrong. But you haven't shown that part of the code, so it's just a guess.


In reply to Re: somethign wrong with the sumbit by graff
in thread somethign wrong with the sumbit by Nik

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.