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

Greetings great wise ones!

I have this script that works just great when viewed and run with IE - but with Netscape - the "Submit" button does not appear and so no selection can be made. Can anyone see why the submit button does not show in Netscape - but works just great with IE?

Thanks in advance for any insight. Blessings....

print " <form action=PageSelect.cgi method=post>\n"; print " <center><select name='selected' size=1>\n"; print " <option value='Make_a_Selection'> ---Select---></option>\n"; print " <option value='$page1'> $page1</option>\n"; print " <option value='$page2'> $page2</option>\n"; print " <input type='submit' name='submit' value='Submit'\n"; print " </select>\n"; print " <option selected value=> $IN{'selected'}</option>\n"; print " <p><b>\n"; print " <option selected value=><Font Color=#0000FF>Page Selected: --- +></Font><Font Color=#FF0000> $in{'selected'}</option></Font></b>\n"; print " </form>

Replies are listed 'Best First'.
Re: Does not work in Netscape
by joe++ (Friar) on Oct 22, 2002 at 08:02 UTC
    ...the "Submit" button does not appear and so no selection can be made...

    Not surprising, as this element is not closed properly (with a ">" character).

    Hint: you might want to look at CGI.pm. It's should already be on your system, try perldoc CGI if you're on Un*x.

    Update: Also, you start the <submit... element halfway the options list, it should be below or above this list. In my opinion the behaviour of Netscape is more correct than IE in this case ;-)

    --
    Cheers, Joe
    Do we need a Disclaimer?

      Good catch.

      perldoc CGI if you're on Un*x

      FFR. Perldoc works fine on AS (though the HTML versions are infinitely more readable).


      Cor! Like yer ring! ... HALO dammit! ... 'Ave it yer way! Hal-lo, Mister la-de-da. ... Like yer ring!
Re: Does not work in Netscape
by moodster (Hermit) on Oct 22, 2002 at 08:28 UTC
    Also, you're putting the <input type="submit"> element inside the <select> element. I don't think that's legal HTML. Try moving the submit button out of the select (you also have some <option> elements that really should be inside the select).

    Cheers,
    --Moodster

Re: Does not work in Netscape
by fruiture (Curate) on Oct 22, 2002 at 08:44 UTC

    Why should any browser display that crap? This is not HTML, this only looks like it, but it isn't. The IE is not a browser, you cannot assume you have done anything correctly if the IE displays it. http://w3.org/TR/html4 will enlighten you what HTML really is and you'll see that you've made a lot of mistakes in that tiny piece of code (i count at least 6 errors and at least 6 deprecated constructs). Consider using CGI.pm for HTML-output on the fly or use templates.

    update: The list of mistakes/deprecated things for someone:

    1. unquoted attribute values, at least non-numeriocs values should be quoted.
    2. "---Select--->" must be "---Select--&gt;"
    3. input tag syntax error (closing > is missing)
    4. input element at impossible position
    5. 2 option elements with broken syntax
    6. 2 option elements at impossible position
    7. again unencoded >
    8. use of FONT element deprecated
    9. use of unquoted attributes deprecated
    10. B element deprecated
    11. unclosed P elements, well, HTML4, but not XHTML ;)
    --
    http://fruiture.de
Re: Does not work in Netscape
by Donnie (Acolyte) on Oct 22, 2002 at 21:37 UTC
    Thank you to all who responded. With your good advice I was able to clean this up and make it work. I am grateful! Blessings to all!