Results 1 to 5 of 5

Thread: POST variables without sending a form

  1. #1
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default POST variables without sending a form

    I've looked around google and php.net, but no luck.

    Is there any way to send post vars to another page?

    Sending a form works, I suppose... but... kinda limited at times.

    Is there any way around this?


    Or, failing that, I know that an image can be an input for a form, but is there a way that a link could be a "submit button" like an image can?

  2. #2
    Join Date
    Dec 2004
    Location
    UK
    Posts
    2,358
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by djr33
    Is there any way to send post vars to another page?
    From browser to server? The only reliable way is using a form.

    Or, failing that, I know that an image can be an input for a form, but is there a way that a link could be a "submit button" like an image can?
    Style the submit button to look like a link.

    Mike

  3. #3
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    GET vars, yes. POST vars are trickier; PHP provides, insofar as I know, no direct support. Instead, you must use fsockopen() to connect with the server and construct the HTTP request yourself.
    Quote Originally Posted by Mike
    From browser to server? The only reliable way is using a form.
    From PHP.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  4. #4
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Twey, you seem to imply there might be a way with another setup? What is that, and how hard would it be?

    And, could you provide a bit more info about the fsockopen, http request, etc? Totally new territory for me.


    Mike, the only "reliable" way? What else?

    And, how would one style a button like that?

  5. #5
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Mike, the only "reliable" way? What else?
    If Mike dismissed it as "unreliable," it's not worth doing In this case, it would likely involve XMLHttpRequest, which allows you to send POST data as an argument to the send() method, in the form send("name=value").
    Twey, you seem to imply there might be a way with another setup? What is that, and how hard would it be?
    I think libcurl provides handlers for this kind of thing, but I don't know anything about it.
    And, could you provide a bit more info about the fsockopen, http request, etc? Totally new territory for me.
    http://www.w3.org/Protocols/rfc2616/rfc2616.html
    http://www.php.net/fsockopen
    And, how would one style a button like that?
    Code:
    input.notAButtonHonest {
      border-style: none;
      background-color: transparent;
      color: blue;
      text-decoration: underline;
    }
    
    input.notAButtonHonest:visited {
      color: purple;
    }
    
    input.notAButtonHonest:active {
      color: red;
    }
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

Bookmarks

Posting Permissions

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