Results 1 to 5 of 5

Thread: url to post things rather than get things (pls help)

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Apr 2002
    Posts
    183

    url to post things rather than get things (pls help)

    Ello all Im sure you all know about how you can use a URL to get a webpage from a cgi script (sorry Im not sure how to word that well). Anyone from my meagre understanding that url automaticly makes it use the method GET, I was wandering if there is a way to make it use POST. Or am I totaly muddled?


  2. #2

    Thread Starter
    Addicted Member
    Join Date
    Apr 2002
    Posts
    183
    I found this javascript so I can make a website to do what I want rather than a specialy crafted URL....
    PHP Code:
    <HTML>
    <
    BODY onload="dosubmit()" bgcolor="#0ffff0">
    <
    SCRIPT LANGUAGE=JAVASCRIPT>
        function 
    dosubmit() {
        
    document.forms[0].action "http://somesite.com/somescript.php"
        
    document.forms[0].method "POST"
        
    document.forms[0].submit()
    }
    </
    SCRIPT>
    <
    FORM NAME=FORM1>
    <
    INPUT TYPE=hidden NAME=athing VALUE="anything">
    <
    INPUT TYPE=hidden NAME=name VALUE="1">
    <
    INPUT TYPE=hidden NAME=woooo VALUE="1">
    <
    INPUT TYPE=hidden NAME=submit VALUE="anyvalue here">
    <
    INPUT TYPE=BUTTON NAME=BT1 VALUE="lalalala" onClick="dosubmit()">
    </
    FORM>
    </
    BODY>
    </
    HTML
    could someone please tell me whats wrong with this so I can get it working :P

  3. #3
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    I'm totally confused about what you're asking. But...

    Code:
    <html>
    <body onLoad="dosubmit();" bgcolor="#0ffff0">
    <script language="JavaScript">
        function dosubmit() {
            document.forms[0].submit()
        }
    </script>
    <form name="form1" method="post" action="http://somesite.com/somescript.php">
    <input type="hidden" name="athing" value="anything">
    <input type="hidden" name="name" value="1">
    <input type="hidden" name="woooo" value="1">
    <input type="hidden" name="submit" value="anyvalue here">
    <input type="button" name="BT1" value="lalalala" onClick="dosubmit();">
    </form>
    </body>
    </html>
    Tags should be lowercased, property values should be quoted, etc.

    And why are you having a page that submits the form right when it loads? That's beyond me...
    My evil laugh has a squeak in it.

    kristopherwilson.com

  4. #4
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170
    Every access to that page would 'spam' the page... interesting.

  5. #5
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    Originally posted by mendhak
    Every access to that page would 'spam' the page... interesting.
    I was thinking the same thing.

    Why even have a button on the page? It's just going to submit every time it loads.

    And why is this in General PC?
    My evil laugh has a squeak in it.

    kristopherwilson.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width