× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.


  • Subject: Re: Mixing GET and POST Methods
  • From: Mel Rothman <mel@xxxxxxxxxxxxxx>
  • Date: Fri, 27 Jul 2001 17:48:23 -0500

Do the code snippets below illustrate what is happening?

A form that looks like this (it could have been generated by a program)

<form  action="/cgidev2p/testdual.pgm?data=something" method="post">
<input type="text" name="FromPost" value="PostData" size="10"
maxlength="10">
<input type="submit" name="submit" value="Submit">
</form>

Program testdual looks like this:

C                   eval      nbrVars =                           
C                             zhbgetinput(savedquerystring:qusec) 
C                   eval      frompost = ZhbGetVar('frompost')    

savequerystring contains "data="
frompost contains "FromPost"

savedquery string should contain data=something.

If this is the case, this is an http server bug.  I'll report it to
development.

In the meantime, you can circumvent it by adding an & to the end of the
data and then trimming it off in the CGI program.  For example:

<form  action="/cgidev2p/testdual.pgm?data=something&" method="post"> 

C                   eval      i = %len(savedquerystring)
C                   if        if i > 0 and
%subst(savedquerystring:i:1)='&'
C                   eval      savedquerystring =
%subst(savedquertystring:1:i-1)
C                   endif


Mel Rothman
CGIDEV2 Author
IBM Rochester





"Christopher A. Libby" wrote:
> 
> As a side note, I tried two tests.  I first changed the form method to GET
> and included a hidden field (func) in the form.  The program worked as
> expected.  Second, with the new form I changed the method back to POST.  The
> program again worked as expected.  Can I just not mix GET and POST in the
> same web page?
> 
> -Chris
> 
> ---------------------------------------------------------
> Christopher A. Libby, Programmer/Analyst
> Maine Public Service Company (www.mainepublicservice.com)
> clibby@mainepublicservice.com (207) 768-5811 ext. 2210
> 
> > -----Original Message-----
> > From: Christopher A. Libby [mailto:clibby@mainepublicservice.com]
> > Sent: Friday, July 27, 2001 3:43 PM
> > To: WEB400@midrange.com
> > Subject: RE: Mixing GET and POST Methods
> >
> >
> > Thanks for the help.  I've made the changes and updated the
> > service program.  I also restarted the server, but I still get
> > the same problem.  I think I may have mistated my question
> > earlier.  I'm using the GET method to direct my program to the
> > correct subroutine, and the POST method the transmit form data.
> > To setup a new account, I use GET to direct my program to the
> > NEWACCT2 subroutine, and POST to transmit the form information to
> > the program.  Below is the main program, and the program seems to
> > fail at the point where it tries to extract Function from
> > savedquerystring, whose value is "func=".  The URL submitted to
> > the server is "http://.../weblibp/webcusinq.pgm?func=vrfyacct".
> >
> >
> > *--------------------------------------------------------------------
> >       * START Main Progam
> >
> > *--------------------------------------------------------------------
> >
> >       * initialize the program
> >      C                   Exsr      Init
> >
> >       * turn debugging on or off - see JobDebugIndicator
> >      C                   callp     wrtjobdbg(JobDebugInd)
> >
> >       * read in HTML source file
> >      C                   Exsr      LoadHTML
> >
> >       * get user input
> >      C                   eval      nbrVars =
> > zhbgetinput(savedquerystring:qusec)
> >
> >      C                   callp
> > updHTMLVar('COMPANY':company:InitHTMLVars)
> >      C                   callp
> > updHTMLVar('SITETITLE':sitetitle:ChgHTMLVars)
> >      C                   callp
> > updHTMLvar('BASEHREF':basehref:chgHTMLvars)
> >      C                   callp     wrtsection('header')
> >
> >       * if no parameters, show login screen
> >      C                   If        nbrVars = 0
> >      C                   Exsr      ShowLogin
> >      C                   Eval      GetOut = '1'
> >      C                   EndIf
> >
> >       * populate session datastructure
> >      C                   eval      Function = zhbgetvar('func')
> >               Function
> >      C                   eval      SessionID =
> > zhbgetvar('sessionid')           SessionID
> >      C                   eval      ErrorID = zhbgetvar('error')
> >               Error Msg
> >
> >      C                   If        ErrorID <> *Blanks
> >      C                   Exsr      ShowLogin
> >      C                   Eval      GetOut = '1'
> >      C                   EndIf
> >
> >      C                   If        GetOut = '0'
> >      C                   Select
> >      C                   When      Function = 'newacct'
> >      C                   Exsr      NewAcct
> >      C                   When      Function = 'vrfyacct'
> >      C                   Exsr      NewAcct2
> >      C                   When      Function = 'auth'
> >      C*                  Exsr      Authenticate
> >      C                   When      Function = 'main'
> >      C*                  Exsr      RetrieveSession
> >      C*                  Exsr      ShowMain
> >      C                   Other
> >      C                   eval      ErrorID='errGen1'
> >      C                   exsr      ShowLogin
> >      C                   EndSl
> >      C                   EndIf
> >
> >      C                   callp     updHTMLVar('DISCLAIMER':sitetitle:
> >      C                             ChgHTMLVars)
> >      C                   callp     wrtsection('footer')
> >      C                   callp     wrtsection('*fini')
> >
> >      C     EndAll        Tag
> >      C                   Return
> >
> > *--------------------------------------------------------------------
> >       * END   Main Progam
> >
> > *--------------------------------------------------------------------
> >
> >
> > ---------------------------------------------------------
> > Christopher A. Libby, Programmer/Analyst
> > Maine Public Service Company (www.mainepublicservice.com)
> > clibby@mainepublicservice.com (207) 768-5811 ext. 2210
> >
> >
> 
> +---
> | This is the WEB400 Mailing List!
> | To submit a new message, send your mail to WEB400@midrange.com.
> | To subscribe to this list send email to WEB400-SUB@midrange.com.
> | To unsubscribe from this list send email to WEB400-UNSUB@midrange.com.
> | Questions should be directed to the list owner/operator: david@midrange.com
> +---
+---
| This is the WEB400 Mailing List!
| To submit a new message, send your mail to WEB400@midrange.com.
| To subscribe to this list send email to WEB400-SUB@midrange.com.
| To unsubscribe from this list send email to WEB400-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.