keeping search query in search form after search

Discussion in 'PHP' started by monkeyclap, Feb 9, 2010.

  1. #1
    can, anyone help please



     
    monkeyclap, Feb 9, 2010 IP
  2. [x[x]x]

    [x[x]x] Peon

    Messages:
    813
    Likes Received:
    30
    Best Answers:
    0
    Trophy Points:
    0
    #2
    <?php echo $_POST['q']; ?>
    PHP:
    this should work ;)
     
    [x[x]x], Feb 9, 2010 IP
    monkeyclap likes this.
  3. monkeyclap

    monkeyclap Active Member

    Messages:
    836
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    85
    #3
    hmm no luck, i've tried

    $_GET works though :D

    thanks, i would double rep you if i could, hahaha
     
    monkeyclap, Feb 9, 2010 IP
  4. blacksheep666

    blacksheep666 Active Member

    Messages:
    68
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    93
    #4
    since you did not specify the method form, the default is GET method.

    it should be like this <form action="/test.php" method="POST"> so that $_POST will work.
     
    blacksheep666, Feb 9, 2010 IP
    monkeyclap likes this.
  5. monkeyclap

    monkeyclap Active Member

    Messages:
    836
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    85
    #5
    thanks for that, i'm now using POST as the method to avoid hellishly long urls, cheers
     
    monkeyclap, Feb 10, 2010 IP