[Klone-users] GET/POST confused methods

thomas fossati tho at koanlogic.com
Thu Apr 10 05:01:30 EDT 2008


Hi Mickael,

On Apr 10, 2008, at 8:56 AM, Mickael Auger wrote:
> My new question concerns the GET and POST methods. Their reunion  
> does not distinguish them when they are used at the same time.
> The next example (named index.kl1) shows this problem :
>
>     <%!
>         char* valeur = NULL;
>     %>
>     <html>
>     <body>
>     <p>
>     <form method="POST" action="index.kl1?vala=getvara&valb=getvarb">
>         <input type="hidden" name="vara" value="postvara" />
>         <input type="hidden" name="varb" value="postvarb" />
>         <input type="submit" value="Send" name="send" />
>     </form>
>     </p>
>     <%
>     valeur = request_get_arg(request, "send");
>     if(valeur != NULL)
>     {
>         io_printf(out, "<p>Used method : %i</p>",  
> request_get_method(request));
>         io_printf(out, "<p>Receive values :<ul><li>vara : %s</ 
> li><li>varb : %s</li></ul></p>", request_get_arg(request, "vara"),   
> request_get_arg(request, "varb"));
>     }
>     %>
>     </body>
>     </html>
>
> For this example the used method is "HM_POST", "vara = getvara" and  
> "varb = getvarb". The POST values are forgotten.

what do you mean exactly by "POST values are forgotten" ?

I've tried out your sample: first I GET the page in my browser (i.e.  
the form with the "Send" button), then when I press the button, 'vara'  
and 'varb' variables with the hardcoded values are POSTed to  
index.kl1.  At this point request_get_arg() return some value (i.e.  
'valeur' is non-NULL as it contains the parsed query) and the  
io_printf() branch is entered displaying the expected values:

=-=-=-=-=-=-=-=-=-=-=
Used method : 3 (i.e. POST)
Receive values:
	* vara : postvara
	* varb : postvarb
=-=-=-=-=-=-=-=-=-=-=

which seems correct to me.  What would you expect instead ?

ciao, t.




More information about the klone-users mailing list