form method=post --> what are the query parameters in the url ?

Discussion in 'HTML' started by bauhaus, Mar 25, 2009.

  1. bauhaus

    bauhaus Guest

    I have a html page containing this form:

    <form method="post" action="http://binsearch.info/fcgi/nzb.fcgi">
    <input name="action" value="nzb">
    <input value="NZB" type="submit">
    </form>

    When I load the html page in my browser and press the submit button, it
    downloads a nzb file.

    But how can I execute it directly from the url without pressing the submit
    button, what are the parameters ?

    I tried this: http://binsearch.info/fcgi/nzb.fcgi?action=nzb but then I get
    the error: no parameters.

    Any suggestions ?
     
    bauhaus, Mar 25, 2009
    #1
    1. Advertising

  2. bauhaus

    rf Guest

    bauhaus wrote:
    > I have a html page containing this form:
    >
    > <form method="post" action="http://binsearch.info/fcgi/nzb.fcgi">
    > <input name="action" value="nzb">
    > <input value="NZB" type="submit">
    > </form>
    >
    > When I load the html page in my browser and press the submit button,
    > it downloads a nzb file.
    >
    > But how can I execute it directly from the url without pressing the
    > submit button, what are the parameters ?
    >
    > I tried this: http://binsearch.info/fcgi/nzb.fcgi?action=nzb but then
    > I get the error: no parameters.


    The server side script is *expecting* method=post.
     
    rf, Mar 26, 2009
    #2
    1. Advertising

  3. bauhaus

    Lars Eighner Guest

    In our last episode, <wEyyl.176017$2>, the lovely and
    talented bauhaus broadcast on alt.html:

    > I have a html page containing this form:


    ><form method="post" action="http://binsearch.info/fcgi/nzb.fcgi">
    ><input name="action" value="nzb">
    ><input value="NZB" type="submit">
    ></form>


    > When I load the html page in my browser and press the submit button, it
    > downloads a nzb file.


    > But how can I execute it directly from the url without pressing the submit
    > button, what are the parameters ?


    You really need to get a basic understanding of the difference between
    GET and POST. You cannot fake POST in the url.

    > I tried this: http://binsearch.info/fcgi/nzb.fcgi?action=nzb but then I get
    > the error: no parameters.


    Because the method is POST, not GET.

    > Any suggestions ?


    --
    Lars Eighner <http://larseighner.com/>
    64 days since Rick Warren prayed over Bush's third term.
    Obama: No hope, no change, more of the same. Yes, he can, but no, he won't.
     
    Lars Eighner, Mar 26, 2009
    #3
  4. Re: form method=post --> what are the query parameters in the url?

    bauhaus wrote:
    > I have a html page containing this form:
    >
    > <form method="post" action="http://binsearch.info/fcgi/nzb.fcgi">
    > <input name="action" value="nzb">
    > <input value="NZB" type="submit">
    > </form>
    >
    > When I load the html page in my browser and press the submit button, it
    > downloads a nzb file.
    >
    > But how can I execute it directly from the url without pressing the
    > submit button, what are the parameters ?
    >
    > I tried this: http://binsearch.info/fcgi/nzb.fcgi?action=nzb but then I
    > get the error: no parameters.
    >
    > Any suggestions ?


    For that to work, the program nzb.fcgi has to check both the URL and the
    body of the request to see if the expected parameters are present. If it
    only checks the body of the request (which is where form control names
    and values are placed), then you can't fake the form with URL parameters.
     
    Harlan Messinger, Mar 26, 2009
    #4
  5. bauhaus

    Andy Guest

    "Harlan Messinger" <> wrote in message
    news:...
    > bauhaus wrote:
    >> I have a html page containing this form:
    >>
    >> <form method="post" action="http://binsearch.info/fcgi/nzb.fcgi">
    >> <input name="action" value="nzb">
    >> <input value="NZB" type="submit">
    >> </form>
    >>
    >> When I load the html page in my browser and press the submit button, it
    >> downloads a nzb file.
    >>
    >> But how can I execute it directly from the url without pressing the
    >> submit button, what are the parameters ?
    >>
    >> I tried this: http://binsearch.info/fcgi/nzb.fcgi?action=nzb but then I
    >> get the error: no parameters.
    >>
    >> Any suggestions ?

    >
    > For that to work, the program nzb.fcgi has to check both the URL and the
    > body of the request to see if the expected parameters are present. If it
    > only checks the body of the request (which is where form control names and
    > values are placed), then you can't fake the form with URL parameters.



    This will work provided the user isn't one of those paranoid types that turn
    off JavaScript...

    <html>
    <head>

    <script language="JavaScript" type="text/JavaScript">
    <!-- AUTO-SUBMIT FORM
    function submit_form(){
    document.myform.submit();
    }
    // - End of JavaScript - -->
    </script>

    </head>
    <body onload="submit_form();">

    <form name="myform" method="post"
    action="http://binsearch.info/fcgi/nzb.fcgi">
    <input name="action" value="nzb">
    <input value="NZB" type="submit">
    </form>

    </body>
    </html>


    Hope this helps

    Andy
     
    Andy, Mar 26, 2009
    #5
  6. bauhaus

    bauhaus Guest

    > For that to work, the program nzb.fcgi has to check both the URL and the
    > body of the request to see if the expected parameters are present. If it
    > only checks the body of the request (which is where form control names and
    > values are placed), then you can't fake the form with URL parameters.


    So what you're saying is that it all depends on the kind of script, some use
    the url and others don't ?
    Ok, that makes sense.
     
    bauhaus, Mar 26, 2009
    #6
  7. bauhaus

    bauhaus Guest

    > Because the method is POST, not GET.

    Thats whats confusing me.
    I have another similar example:

    <form name="top" action="?m=gen" method="POST">
    <input type="submit" value="Get NZB" name="getnzb">
    <input type="hidden" name="p" value="244416">
    <input type="hidden" name="mode" value="usenet">
    <input type="hidden" name="offset" value="0">
    <input type="hidden" name="type" value="">
    <input type="hidden" name="group" value="">
    <input type="hidden" name="q" value="">
    <input type="hidden" name="age" value="200">
    <input type="hidden" name="get" value="0">
    </form>

    Now, when I try this:
    http://www.newzleech.com/?m=gen&get...et&type=&group=&q=&age=&get=0&offset=0&binary[]=1001917

    It DOES download the file....

    So whats the difference between this example and the previous one ?
     
    bauhaus, Mar 26, 2009
    #7
  8. bauhaus

    bauhaus Guest

    > This will work provided the user isn't one of those paranoid types that
    > turn off JavaScript...
    >
    > <html>
    > <head>
    >
    > <script language="JavaScript" type="text/JavaScript">
    > <!-- AUTO-SUBMIT FORM
    > function submit_form(){
    > document.myform.submit();
    > }
    > // - End of JavaScript - -->
    > </script>
    >
    > </head>
    > <body onload="submit_form();">
    >
    > <form name="myform" method="post"
    > action="http://binsearch.info/fcgi/nzb.fcgi">
    > <input name="action" value="nzb">
    > <input value="NZB" type="submit">
    > </form>
    >
    > </body>
    > </html>


    Thanks Andy, works like a charm !
     
    bauhaus, Mar 26, 2009
    #8
  9. bauhaus

    rf Guest

    bauhaus wrote:
    >> Because the method is POST, not GET.

    >
    > Thats whats confusing me.
    > I have another similar example:
    >
    > <form name="top" action="?m=gen" method="POST">
    > <input type="submit" value="Get NZB" name="getnzb">
    > <input type="hidden" name="p" value="244416">
    > <input type="hidden" name="mode" value="usenet">
    > <input type="hidden" name="offset" value="0">
    > <input type="hidden" name="type" value="">
    > <input type="hidden" name="group" value="">
    > <input type="hidden" name="q" value="">
    > <input type="hidden" name="age" value="200">
    > <input type="hidden" name="get" value="0">
    > </form>
    >
    > Now, when I try this:
    > http://www.newzleech.com/?m=gen&get...et&type=&group=&q=&age=&get=0&offset=0&binary[]=1001917
    >
    > It DOES download the file....
    >
    > So whats the difference between this example and the previous one ?


    You snipped the most important bit from Lars's post:

    >>You really need to get a basic understanding of the difference between
    >>GET and POST. You cannot fake POST in the url.


    There is get and there is post. It is up to the server side process to look
    for post of get or either. Some do both. Some do get. Some do post.

    Your first example obvously contacted a server side process that only
    accepted post.

    You current example obvously contacted a server side process that accepted
    either.

    A server side process that looks for get will parse the URL it is given to
    obtain the get parameters (the bit following the ? in the URL);

    A server side process that looks for post will delve into the request
    headers to obtain the post parameters.
     
    rf, Mar 26, 2009
    #9
  10. bauhaus

    rf Guest

    Andy wrote:
    > "Harlan Messinger" <> wrote in
    > message news:...
    >> bauhaus wrote:
    >>> I have a html page containing this form:
    >>>
    >>> <form method="post" action="http://binsearch.info/fcgi/nzb.fcgi">
    >>> <input name="action" value="nzb">
    >>> <input value="NZB" type="submit">
    >>> </form>
    >>>
    >>> When I load the html page in my browser and press the submit
    >>> button, it downloads a nzb file.
    >>>
    >>> But how can I execute it directly from the url without pressing the
    >>> submit button, what are the parameters ?
    >>>
    >>> I tried this: http://binsearch.info/fcgi/nzb.fcgi?action=nzb but
    >>> then I get the error: no parameters.
    >>>
    >>> Any suggestions ?

    >>
    >> For that to work, the program nzb.fcgi has to check both the URL and
    >> the body of the request to see if the expected parameters are
    >> present. If it only checks the body of the request (which is where
    >> form control names and values are placed), then you can't fake the
    >> form with URL parameters.

    >
    >
    > This will work provided the user isn't one of those paranoid types
    > that turn off JavaScript...


    This issue has nothing at all to do with JavaScript.
     
    rf, Mar 26, 2009
    #10
  11. bauhaus

    Neredbojias Guest

    On 26 Mar 2009, "bauhaus" <> wrote:

    >> Because the method is POST, not GET.

    >
    > Thats whats confusing me.
    > I have another similar example:
    >
    > <form name="top" action="?m=gen" method="POST">
    > <input type="submit" value="Get NZB" name="getnzb">
    > <input type="hidden" name="p" value="244416">
    > <input type="hidden" name="mode" value="usenet">
    > <input type="hidden" name="offset" value="0">
    > <input type="hidden" name="type" value="">
    > <input type="hidden" name="group" value="">
    > <input type="hidden" name="q" value="">
    > <input type="hidden" name="age" value="200">
    > <input type="hidden" name="get" value="0">
    > </form>
    >
    > Now, when I try this:
    > http://www.newzleech.com/?m=gen&getnzb=Get NZB&p=244416&mode=usenet&
    > type=&group=&q=&age=&get=0&offset=0&binary[]=1001917
    >
    > It DOES download the file....
    >
    > So whats the difference between this example and the previous one ?


    Typically, server side scripts treat post variables separate from get
    variables which means (for example) substituting GET p for POST p will
    leave POST p null.

    --
    Neredbojias
    People who live in glass houses must feel funny peeing.
    http://www.neredbojias.org/
    http://www.neredbojias.net/
     
    Neredbojias, Mar 26, 2009
    #11
  12. bauhaus

    Jan Faerber Guest

    On 26 Mrz., 12:16, "bauhaus" <> wrote:

    > > function submit_form(){
    > > document.myform.submit();


    Here you could add:

    setTimeout("self.close()", 1000);
    }

    // - End of JavaScript - -->
    </script>
    > > }


    Couldn't u?
     
    Jan Faerber, Mar 26, 2009
    #12
  13. bauhaus

    Lars Eighner Guest

    In our last episode, <w7Jyl.147060$2>, the lovely and
    talented bauhaus broadcast on alt.html:

    >> For that to work, the program nzb.fcgi has to check both the URL and the
    >> body of the request to see if the expected parameters are present. If it
    >> only checks the body of the request (which is where form control names and
    >> values are placed), then you can't fake the form with URL parameters.


    > So what you're saying is that it all depends on the kind of script, some
    > use the url and others don't ?


    Why don't you crack a book? --- that's what we are saying.

    You cannot fake the POST method with the request string in the url. There
    are a number of good reasons to prefer either POST or GET in certain
    situations. One --- just one --- of the reasons to prefer POST is that it
    prevents someone from linking or bookmarking to something in the middle of a
    series of forms which need to be completed in sequence.

    In some simple situations, the choice between POST and GET is arbitrary.
    Since just about every server that can run a script will make will make the
    full url string available in the script's environment, the author of a
    script that should expect POST data can choose accidentally or on purpose
    to parse the url string. This might be done on purpose for testing. It
    might be done accidentally because the author does not know how to look for
    POST data specifically or forgot to change things after testing. Since the
    script might be fixed at any time, a link or bookmark that works today may
    fail tomorrow.


    > Ok, that makes sense.


    --
    Lars Eighner <http://larseighner.com/>
    64 days since Rick Warren prayed over Bush's third term.
    Obama: No hope, no change, more of the same. Yes, he can, but no, he won't.
     
    Lars Eighner, Mar 26, 2009
    #13
  14. On Mar 26, 5:16 pm, Lars Eighner <> wrote:
    > In our last episode, <w7Jyl.147060$2>, the lovely and
    > talented bauhaus broadcast on alt.html:
    >
    > >> For that to work, the program nzb.fcgi has to check both the URL and the
    > >> body of the request to see if the expected parameters are present. If it
    > >> only checks the body of the request (which is where form control names and
    > >> values are placed), then you can't fake the form with URL parameters.

    > > So what you're saying is that it all depends on the kind of script, some
    > > use the url and others don't ?

    >
    > Why don't you crack a book?  --- that's what we are saying.
    >
    > You cannot fake the POST method with the request string in the url.  There
    > are a number of good reasons to prefer either POST or GET in certain
    > situations.  One --- just one --- of the reasons to prefer POST is that it
    > prevents someone from linking or bookmarking to something in the middle of a
    > series of forms which need to be completed in sequence.
    >
    > In some simple situations, the choice between POST and GET is arbitrary.
    > Since just about every server that can run a script will make will make the
    > full url string available in the script's environment, the author of a
    > script that should expect POST data can choose accidentally or on purpose
    > to parse the url string.  This might be done on purpose for testing.  It
    > might be done accidentally because the author does not know how to look for
    > POST data specifically or forgot to change things after testing.  Since the
    > script might be fixed at any time, a link or bookmark that works today may
    > fail tomorrow.
    >
    > > Ok, that makes sense.

    >
    > --
    >         Lars Eighner <http://larseighner.com/> use...@larseighner..com
    >             64 days since Rick Warren prayed over Bush's third term.
    >   Obama: No hope, no change, more of the same. Yes, he can, but no, he won't.





    I am a TOTAL newbie to HTML, though I'm pretty good at Flash 2 & 3.

    I need to pass a value (the user name) to an HTML page that is the
    menu for a group of Flash games.

    So, the HTML page nees to receive a string, and then pass it on when
    it calls the game selected by the user.

    I call the HTML page from Flash using (having set the user name
    before)

    getURL("http://Thegames.com/index2.html","_self","GET").... (I think
    I'd prefer to use POST so the name doesn't show in the browser window,
    but this is only a field test, so I can get away with it).

    and the value of user name appears in the browser window, so the
    flash command is sending it properly.

    So how can I pass it on when I call one of the games using

    <a href="Protected/menuSP.html"> /a> ?

    Can you send me a code example that can be 1. called with a value in
    POST 2. send on that value when it does an <a href?

    Thank you very much,

    Mariana

    (I was planning to do my whole games site in Flash, but found out you
    cannot mix AS2 & AS3 in one .swf file, and I have a lot of work
    invested in both.....)
     
    Mariana Delbue, Mar 29, 2009
    #14
  15. bauhaus

    rf Guest

    Mariana Delbue wrote:
    > On Mar 26, 5:16 pm, Lars Eighner <> wrote:


    <snip quoted material that appears to have no relevance to this post>

    > I am a TOTAL newbie to HTML, though I'm pretty good at Flash 2 & 3.


    Yes, but who are you? You seem to have suddenly appeared in this thread with
    your following question which appears to be not about forms but <a>
    elements.

    > I need to pass a value (the user name) to an HTML page that is the
    > menu for a group of Flash games.
    >
    > So, the HTML page nees to receive a string, and then pass it on when
    > it calls the game selected by the user.
    >
    > I call the HTML page from Flash using (having set the user name
    > before)


    OK so far.

    > getURL("http://Thegames.com/index2.html","_self","GET").... (I think
    > I'd prefer to use POST so the name doesn't show in the browser window,
    > but this is only a field test, so I can get away with it).


    This is where you start to fall down. It is not up to you to choose if you
    use get or post. It is the server side script (or whatever) that dictates
    which you use. All of this has been covered already in this thread.

    > and the value of user name appears in the browser window, so the
    > flash command is sending it properly.


    Er...

    > So how can I pass it on when I call one of the games using
    >
    > <a href="Protected/menuSP.html"> /a> ?


    See above.

    > Can you send me a code example that can be 1. called with a value in
    > POST 2. send on that value when it does an <a href?


    Nobody can send you such code because it simply can not be done. A <a> link
    can not send post data. If you really want to do this then you must
    investigate javascript which can intercept the onclick event on the <a>
    element and then investigate XMLHpptRequest which *can* send post data.

    --
    Richard.
     
    rf, Mar 29, 2009
    #15
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jon paugh
    Replies:
    1
    Views:
    947
  2. R L Vandaveer
    Replies:
    0
    Views:
    5,690
    R L Vandaveer
    Dec 22, 2005
  3. Don Glover the younger

    ASP, FORMS, POST METHOD And Post with out form(???)

    Don Glover the younger, Jul 13, 2003, in forum: ASP General
    Replies:
    0
    Views:
    515
    Don Glover the younger
    Jul 13, 2003
  4. Richard Gration

    POST to URL with query string and CGI.pm

    Richard Gration, Jan 23, 2004, in forum: Perl Misc
    Replies:
    2
    Views:
    204
    Richard Gration
    Jan 23, 2004
  5. nick
    Replies:
    1
    Views:
    513
    David Mark
    Feb 13, 2011
Loading...

Share This Page