Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: Perl code doesn't echo form data

by kcott (Archbishop)
on Mar 24, 2020 at 04:25 UTC ( [id://11114590]=note: print w/replies, xml ) Need Help??


in reply to Perl code doesn't echo form data

G'day nrabus,

Welcome to the Monastery.

From your description, it sounds like the problem lies with you web server configuration. I don't know what you're using but I'll take a guess at Apache. You need to specify in your configuration file — possibly named httpd.conf — that the cgi-bin directory has Perl code which the web server should execute. I can't tell you exactly what the configuration code would be; however, it might look something like:

<Directory "/cgi-bin"> SetHandler cgi-script Options +ExecCGI </Directory>

There's quite possibly other directives you'll need. I'm not really comfortable guessing any further.

If it is Apache, the default httpd.conf provides some clues. Get details from "Apache HTTP Server Version 2.4 Documentation"; although, you may need a different version. See the "Directive Index" for links to the documentation for individual directives.

I only briefly looked at your code. You generally seem to be on the right track. You've got a semicolon where you probably should have a comma after the "Last name:" part; alternatively, add another print after it (i.e. just before the "Gender:" part).

You also might like to consult the "CGI" and "CGI::HTML::Functions" documentation.

— Ken

Replies are listed 'Best First'.
Re^2: Perl code doesn't echo form data
by tobyink (Canon) on Mar 24, 2020 at 09:25 UTC

    This.

    It's not a Perl problem or an HTML problem. The web server is misconfigured, or at least there is a mismatch between how it's been configured and how you're trying to use it.

    And that's assuming you're accessing the page through a web server at all. If your web browser is accessing the pages via file:// URLs, this will not work. You need to be accessing the pages over HTTP or HTTPS.

      I'm using a brpwser. I will fix the URL.
Re^2: Perl code doesn't echo form data
by nrabus (Initiate) on Mar 24, 2020 at 19:43 UTC
    Ken, Thank you. I have Apache but didn't have the server started. I will try it. BTW, I have Win 10 with Apache downloaded from official site. Nick'

      I strongly recommend that you get into the habit of checking the Apache access and error logs. You should do this after every test and following all code and config changes: it's often the case that what looks OK from a visual inspection of the web page actually has one or more (not-so-obvious) underlying issues; for instance, perhaps you're accessing code, data, or other resources, from the wrong path.

      And, of course, if the last message in the access log is about the server shutting down, that's a huge clue to the need to actually start the server. :-)

      I provided some Apache-related help a couple of months ago: "Re: configuring mod_perl on Apache2.4 (conf & virtual host help)?". That was mainly related to virtual hosts and nothing to do with your issue; however, there may be a few things you'll find useful — for example, setting up *.bat scripts with similar functionality to the aliases I described may make your life easier.

      — Ken

        Ken, Thank you. I will look at my Apache docs in detail esp. related to formdata. Three more days of extended spring break so have plenty of timeto fix this before online starts up. Nick

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11114590]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (5)
As of 2024-04-19 22:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found