Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Sadly. Entering a domain name in the top field, and hitting enter, does nothing. It doesn't even post a query. However. If I comment out the ip text field, and try it again. It works. ???

If you add a submit button, then Enter will submit the form even if there are multiple text inputs, at least in Firefox 25.0 (the only browser I tested). Without a submit button, Enter submits the form only if there is a single text input but doesn't submit the form if there are multiple text inputs.

The following works for me:

#!/strawberry/perl/bin/perl.exe use strict; use warnings; use CGI; use CGI::Carp qw(fatalsToBrowser); use Net::Whois::Raw; use Net::Whois::ARIN; $Net::Whois::Raw::OMIT_MSG = 1; $Net::Whois::Raw::CACHE_TIME = 1; $Net::Whois::Raw::TIMEOUT = 8; my $q = new CGI; my $domname = $q->param("domname"); my $ip = $q->param("ip"); print "content-type:text/html; charset=utf-8\n\n"; print qq(<!DOCTYPE html> <head><title>igwhois</title></head><body>); print qq( <form method="post"> <fieldset> <label for="domname">Domain: </label><input type="text" name="domn +ame" /><br /> <label for="ip">IP: </label><input type="text" name="ip" /> </fieldset> <input type="submit" value="Submit"> </form> ); if (!$domname) { print ""; } else { my $text = get_whois($domname, undef, "QRY_LAST"); print qq(<pre>); print $text; print qq(</pre>); } my $w = Net::Whois::ARIN->new( host => 'whois.arin.net', port => 43, timeout => 30, ); if (!$ip) { print ""; } else { my $text = $w->query("n + $ip"); print qq(<pre>); print $text; print qq(</pre>); } print qq(</body></html>);

In reply to Re^3: How to deal with multiple functions served from only one input field? by ig
in thread How to deal with multiple functions served from only one input field? by taint

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 sharing their wisdom with the Monastery: (4)
As of 2024-04-23 07:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found