SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Feb 2002
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Http POST Question

    Is it possible to pass a variable through POST using
    hypertext?
    <currently stuck with GET>

    echo ("<a href ='$PHP_SELF?&myvariable=newvalue'>link</a>")

    </currently stuck with GET>


    Or is POST limited to forms?

    <form method='POST'>
    </form>

    Thanks,

    Andrew

  2. #2
    SitePoint Wizard silver trophy redemption's Avatar
    Join Date
    Sep 2001
    Location
    Singapore
    Posts
    5,269
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    the query string format is like this:
    Code:
    http://www.domain.org/index.php?first=somevalue&second=yavalue
    notice that in your code you've an ampersand (&) immediately after the '?'.... the '&' is used for separating several values you want to pass like above, so you shouldn't have the ampersand above...

    and no i don't think you can use the query to POST variables...

    btw, your PHP code should be like this:
    PHP Code:
    echo ("<a href ='$PHP_SELF?myvariable=newvalue'>link</a>"): 

  3. #3
    SitePoint Enthusiast
    Join Date
    Mar 2002
    Posts
    49
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Use hidden fields to pass paramaters via POST
    Code:
    <form method='POST'> 
    <INPUT TYPE="hidden" NAME="myvariable" VALUE="newvalue">
    </form>


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
  •