Can't get basic CGI and Form submission working

T

Toby Rodwell

I'm not a programmer, but like to use Ruby for writing simple programs,
mainly for helping with my day job (as a network engineer). My normal
method of coding is to take an example out a book ("The Pragmatic
Programmers Guide", what else? :)) and tailor/expand it to to my needs.

I've just written a program which produces its results in HTML, for
convenient viewing. I'm feeling a little more ambitious now and would
like now to get a *small* amount of interaction using simple forms.
However, I'm not really getting past the first hurdle. I *thought* that
putting
<form method="post" action="<path_to_ruby_script>">
"STUFF"
<input type ="submit" />
</form>

... would run the script indicated. Instead I get a '404' "The
requested URL <path...> was not found on this server."

I also tried
<form target="<path_to_ruby_script>"> ...
<input type ="submit" />
</form>

In fact, I tried this version first but it neither worked nor gave me
any errors. I know the script in question itself works because I can
run it from the command line (plus it is just creating a 'Hello World!'
file) - which is to say I chmod 755 the file and started it with the
path to the Ruby bin.

I'm probably missing something really basic, and any advice would be
gratefully received.

thanks in advance
 
T

Toby Rodwell

unknown wrote:
...
Sounds like the web server isn't allowing POSTs to that directory.
Try changing the form to a GET and see whether it works; if it does,
that's the issue.

This has fairly little to do with Ruby per se, and a lot to do with
whatever web server you're running.

-s

Makes sense - I'll investigate the web-server settings.

thanks
Toby
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top