cancel
Showing results for 
Search instead for 
Did you mean: 

CGI scripts

shermans
Pro
Posts: 1,303
Thanks: 101
Fixes: 3
Registered: ‎07-09-2007

CGI scripts

Can anyone help with CGI scripts ?  I am having difficulty with a Form which I have used before as standard - it is one of Matt's Scripts, which I believe is the most popular PERL standard script available.  I use dto use it a lot with great success, but lately even copying the old script I used to use, the forms I get sent back to me are unreliable.  I do notice that the script has been updated and I cannot see what I am doing wrong.  I believe that the Plusnet CGI server is pre-loaded with this basic Matt Script already.
This is the code I have been using; sometimes I receive the forms, sometimes I don't - more often than not, I don't.

<!-- Webform -->
<form method="post" action="http://homepages.plus.net/cgi-bin/form"><div>
<input type=hidden name="recipient" value="mail@username.plus.com">
<input type=hidden name="subject" value="Request ">
<input type=hidden name="redirect" value="http://www.username.plus.com/end.htm">
<input type=hidden name="required" value="realname,email,Telephone">
<input type=hidden name="print_blank_fields" value="1">
<font size="5" face="times new roman">
Name <input size=30 type=text name="realname">
E-mail <input size=30 type=text name="email">
<P>House name or number <INPUT name=Housename>
Street <INPUT name=Street>
<P>Town <INPUT name=Town>
County <INPUT size=12 name=County> Post Code <INPUT size=8 name=Postcode>
Telephone <INPUT size=16 name=Telephone>

....................... etc. and then finally :

<input type="submit" value="Send my form now">
Can anyone see what I am doing wrong.  The area where I am suspicious is the line <input type="submit" value="Send my form now">.  I have seen references that my code should include POST or GET instead, but I don't know what that means.
1 REPLY 1
Prod_Man
Grafter
Posts: 287
Registered: ‎04-08-2007

Re: CGI scripts


<form method="post" action="http://homepages.plus.net/cgi-bin/form"><div>
<input type=hidden name="recipient" value="mail@username.plus.com">
<input type=hidden name="subject" value="Request ">
<input type=hidden name="redirect" value="http://www.username.plus.com/end.htm">
<input type=hidden name="required" value="realname,email,Telephone">
<input type=hidden name="print_blank_fields" value="1">
<font size="5" face="times new roman">
Name <input size=30 type=text name="realname">
E-mail <input size=30 type=text name="email">
<P>House name or number <INPUT name=Housename>
Street <INPUT name=Street>
<P>Town <INPUT name=Town>
County <INPUT size=12 name=County> Post Code <INPUT size=8 name=Postcode>
Telephone <INPUT size=16 name=Telephone>

Tidy that source up, it's not very well composed.

<FORM ACTION = "http://homepages.plus.net/cgi-bin/form" METHOD = "POST">
<DIV>

<INPUT TYPE = "HIDDEN" NAME = "recipient" VALUE = "mail@username.plus.com">
<INPUT TYPE = "HIDDEN" NAME = "subject" VALUE = "Request ">
<INPUT TYPE = "HIDDEN" NAME = "redirect" VALUE = "http://www.username.plus.com/end.htm">
<INPUT TYPE = "HIDDEN" NAME = "required" VALUE = "realname,email,Telephone">
<INPUT TYPE = "HIDDEN" NAME = "print_blank_fields" VALUE = "1">

<TABLE>
<TR> <TD>Name</TD>                <TD><INPUT SIZE = "30" TYPE = "TEXT" NAME = "realname"> </TD> </TR>
<TR> <TD>E-mail</TD>              <TD><INPUT SIZE = "30" TYPE = "TEXT" NAME = "email">    </TD> </TR>
<TR> <TD>House name or number</TD> <TD><INPUT TYPE = "TEXT" NAME = "Housename">            </TD> </TR>
<TR> <TD>Street</TD>              <TD><INPUT TYPE = "TEXT" NAME = "Street">              </TD> </TR>
<TR> <TD>Town</TD>                <TD><INPUT  TYPE = "TEXT" NAME = "Town">                </TD> </TR>
<TR> <TD>County</TD>              <TD><INPUT TYPE = "TEXT" SIZE = "12" NAME = "County">  </TD> </TR>
<TR> <TD>Post Code</TD>            <TD><INPUT TYPE = "TEXT" SIZE = "8" NAME = "Postcode">  </TD> </TR>
<TR> <TD>Telephone</TD>            <TD><INPUT TYPE = "TEXT" SIZE = "16" NAME = "Telephone"></TD> </TR>
<TR> <TD COLSPAN = "2">            <INPUT TYPE = "SUBMIT" VALUE = "Send my form now">      </TD> </TR>
</TABLE>

</DIV>
</FORM>

Your Form was actually missing component parts such as defining datatypes of the input boxes, you didn't mention closing the FORM.
yes although there isn't anything else it could be, it's just some of the many Web Standards for HTML.
Although, it's not enforced by HTML processors in browsers to have ' TYPE = "TEXT" ' on every field,
it's just asking for more problems if it doesn't conform with "Standards".
POST and GET Method is primarily about parsing of Variables between Client to Webserver.
The way the Webbrowser builds the Request,
is down to how the FORM has defined which method to use : ' METHOD = "POST" ' => Walla there is your HTTP Method.
The HTTP Request is then constructed and sent.
In this case I would say you want to use POST,
else with GET Method you'd have a URL a mile long.
POST appends the variables to the bottom of the Request in the Packet(s),
where as GET appends to the very first line requesting the Document from the Server. ( GET /PATH/?vars=values&vars=values )
which is just begging for people to just keep hitting Enter in the URL bar or hitting F5..
(http://en.wikipedia.org/wiki/HTTP + http://www.w3.org/Protocols/rfc2616/rfc2616.html)
Hope something here helps / works Smiley
Jim,