=?ISO-8859-1?Q?Submit_form_doesn=B4t_work.?=

M

Mark

The following -very simple- page doesn´t work. What am I overlooking?
If I press the submit button, IE opens the page react.htm and leaves
it at that. Why doesn´t the contents of the form go to the react.htm
page.

<html>
<head>
<title>Guestbook</title>
</head>
<body>
<h1 align=center> Welcome to the guestbook</h1>
<p> Leave your remarks in the form and press the Submit button</p>
</body>

<form name="reactions" action="react.htm" method="post">
First name:
<input type="text" name="firstname">
<br>
Last name:
<input type="text" name="lastname">
<br>
<textarea rows="10" cols="30">
Put here your reaction
</textarea>
<br>
<input type="submit" value="submit">
</form>

</html>
 
W

William Tasso

Mark said:
The following -very simple- page doesn´t work. What am I overlooking?
If I press the submit button, IE opens the page react.htm and leaves
it at that. Why doesn´t the contents of the form go to the react.htm
page.

it does - how are you handling the data at react.htm?

..htm files are not (usually) server side scripts
 
B

Ben Dover - Mental Patient 0057

Mark said:
The following -very simple- page doesn´t work. What am I overlooking?
If I press the submit button, IE opens the page react.htm and leaves
it at that. Why doesn´t the contents of the form go to the react.htm
page.

<html>
<head>
<title>Guestbook</title>
</head>
<body>
<h1 align=center> Welcome to the guestbook</h1>
<p> Leave your remarks in the form and press the Submit button</p>
</body>

<form name="reactions" action="react.htm" method="post">
Here's the problem!
you're posting to an html file.
you'll want to send it to a handler like a perl script or some other
CGI.
you're not limited to CGI though. depending on the server, you can also
try ASP or PHP.
well here's a popular one:
http://www.scriptarchive.com/guestbook.html
then, you're going to want to post to some perl newsgroup.
I know plenty of perl newsgroups, but I can't think of a beginer
friendly perl newsgroup. maybe someone else can suggest.

you can try this VERY BASIC perl script to handle your form:
first change your file name from react.htm to react.cgi
and add name="comments" to your textarea tag.
now create the file react.cgi and copy and paste this in:

#!/usr/bin/perl -w
use strict;
use warnings;
use CGI qw(param);
my($first)=param('firstname');
my($last)=param('lastname');
my($comments)=param('comments');
open (WRITE, ">>guestbook.txt");
print WRITE "$first $last <br>\n";
print WRITE "$comments<hr>\n";
close (WRITE);

like I said, very basic.
 
M

Mark

William,

Thank you for your response.
I guess the thing I was overlooking was... that I am very VERY new at
this and don´t have a clue about server-side scripts.

Is this the only way to handle this?
Where can I find more info on this subject. What should I look for?

thanks for your help!

Mark
 
W

William Tasso

I guess the thing I was overlooking was... that I am very VERY new at
this and don´t have a clue about server-side scripts.

Is this the only way to handle this?
Where can I find more info on this subject.

Jukka Korpella has made a fine page here:
http://www.cs.tut.fi/~jkorpela/forms/
What should I look for?

forms handling and server side scripting. what scripting dfacilities are
available on your server?

Note: it is customary to post replies after the text you are replying to -
please don't top post.
 
D

Daniel R. Tobias

Mark said:
I guess the thing I was overlooking was... that I am very VERY new at
this and don´t have a clue about server-side scripts.

What were you *expecting* the destination page to do with your form data?
 
I

Isofarro

Ben said:
Here's the problem!
you're posting to an html file.

No, he is posting to a URL that ends in an extension .htm. This _could_ be a
static html file, but there's _nothing_ mandating it. It can easily be an
URL that resolves to a server-side script. That's not where the "problem"
lies.
you'll want to send it to a handler like a perl script or some other
CGI.

Correct. The URL supplied may be a perl script - and probably is, but the
URL is really a red herring.


The page is doing exactly as specified. It is sending the form contents as
part of the HTTP Entity body (because the method is POST), ready to be
extracted by the server-side script.
 
M

Micah Cowan

The following -very simple- page doesn´t work. What am I overlooking?
If I press the submit button, IE opens the page react.htm and leaves
it at that. Why doesn´t the contents of the form go to the react.htm
page.

<html>
<head>
<title>Guestbook</title>
</head>
<body>
<h1 align=center> Welcome to the guestbook</h1>
<p> Leave your remarks in the form and press the Submit button</p>
</body>

<form name="reactions" action="react.htm" method="post">
First name:
<input type="text" name="firstname">
<br>
Last name:
<input type="text" name="lastname">
<br>
<textarea rows="10" cols="30">
Put here your reaction
</textarea>
<br>
<input type="submit" value="submit">
</form>

</html>

Other people have pointed out why the above doesn't work. I'd
like to additionally point out that your ending </body> tag
should go after </form>. The above is not valid HTML (though I
doubt any browsers will fail to process it as you expect).

-Micah
 
J

Jordge W. L.

Isofarro said:
No, he is posting to a URL that ends in an extension .htm. This _could_ be a
static html file, but there's _nothing_ mandating it. It can easily be an
URL that resolves to a server-side script. That's not where the "problem"
lies.

why would you parse a .htm file? shouldn't it be .shtml or something?
 
I

Isofarro

Jordge said:
why would you parse a .htm file? shouldn't it be .shtml or something?

No. file extensions are red herrings in URLs. Always have been, always will
be. URLs point to resources, not files. A resource can be a file or it can
be the resulting output of a process. An extension doesn't determine which
of these the resource will be.
 
T

Toby A Inkster

Isofarro said:
Good demo. You may want to stick a covering page in there explaining what is
going on.

I shan't bother. My 'scratch' directory is only for short-lived examples.
They will probably be deleted within weeks.
 

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

No members online now.

Forum statistics

Threads
473,767
Messages
2,569,570
Members
45,045
Latest member
DRCM

Latest Threads

Top