Discover Habbo's history
Treat yourself with a Secret Santa gift.... of a random Wiki page for you to start exploring Habbo's history!
Happy holidays!
Celebrate with us at Habbox on the hotel, on our Forum and right here!
Join Habbox!
One of us! One of us! Click here to see the roles you could take as part of the Habbox community!


Page 1 of 2 12 LastLast
Results 1 to 10 of 14
  1. #1
    Join Date
    May 2006
    Location
    Hull
    Posts
    7,701
    Tokens
    2,430
    Habbo
    Moh

    Latest Awards:

    Default Form won't submit properly

    I am having a problem with a form, I am using method="GET", and I want it to do the following:

    index.php?page=search&q=Search Term

    But it keeps doing the following:
    index.php?q=Search Term

    The only way I got this working was using javascript, but onsubmit wouldn't work, only onclick. So if you press enter, it goes to:
    index.php?q=Search Term

    +Rep for any help

  2. #2
    Join Date
    May 2005
    Location
    San Francisco, CA
    Posts
    7,160
    Tokens
    2,331

    Latest Awards:

    Default

    Try adding:

    HTML Code:
    <input type="hidden" name="page" id="page" value="search" />
    with the GET method.

  3. #3
    Join Date
    May 2006
    Location
    Hull
    Posts
    7,701
    Tokens
    2,430
    Habbo
    Moh

    Latest Awards:

    Default

    Quote Originally Posted by Invent View Post
    Try adding:

    HTML Code:
    <input type="hidden" name="page" id="page" value="search" />
    with the GET method.
    That's cheating
    But it will do

    Thank You

  4. #4
    Join Date
    Dec 2006
    Location
    Swindon
    Posts
    3,299
    Tokens
    215
    Habbo
    dunko

    Latest Awards:

    Default

    action="index.php?page=search"

    ?

  5. #5
    Join Date
    Dec 2007
    Posts
    1,683
    Tokens
    0

    Latest Awards:

    Default

    Quote Originally Posted by Blob View Post
    action="index.php?page=search"

    ?
    Don't you know how to use get?

  6. #6
    Join Date
    Dec 2006
    Posts
    3,970
    Tokens
    0

    Latest Awards:

    Default

    Quote Originally Posted by Close View Post
    Don't you know how to use get?
    Lol, i think he does.
    Lets set the stage on fire, and hollywood will be jealous.

  7. #7
    Join Date
    Dec 2006
    Location
    Swindon
    Posts
    3,299
    Tokens
    215
    Habbo
    dunko

    Latest Awards:

    Default

    Quote Originally Posted by Independent View Post
    Don't you know how to use get?
    Sorry, but sending a page to index.php?page=search will add all the form things after that, making the end URL end up as index.php?page=search&q=WHATEVER

    fool.

  8. #8
    Join Date
    Dec 2007
    Posts
    1,683
    Tokens
    0

    Latest Awards:

    Default

    Quote Originally Posted by Blob View Post
    Sorry, but sending a page to index.php?page=search will add all the form things after that, making the end URL end up as index.php?page=search&q=WHATEVER

    fool.
    So basically, you want it sent to page.php?page=search without anything else in the URL bar,

    I'd do it some long way like sessions.

  9. #9
    Join Date
    Dec 2007
    Posts
    1,683
    Tokens
    0

    Latest Awards:

    Default

    Quote Originally Posted by Independent View Post
    So basically, you want it sent to page.php?page=search without anything else in the URL bar,

    I'd do it some long way like sessions.
    Couldn't edit above post

    PHP Code:
    <?php
    session_start
    ();

    if(!
    $_GET ['page'] == "search") { 
    echo(
    "<form method=\"post\" action=\"roflcopter.php?page=search\">
    <input name=\"whatisit\">
    <input type=\"submit\" value=\"Search!\">
    </form><br /><br />\"IM FEELING LUCKY\""
    );
    }
    if(
    $_GET ['page'] == "search") {

    $go $_POST['whatisit'];

    $_SESSION['search'] = $go;

    echo 
    $_SESSION['search'];
    }
    ?>
    Un-tidy code I know.. but something along them lines
    Wooohoo, I made something that works.

  10. #10
    Join Date
    Dec 2007
    Posts
    1,683
    Tokens
    0

    Latest Awards:

    Default

    Offtopic (ish):

    PHP Code:
    <?php
    session_start
    ();

    if(!
    $_GET ['page'] == "search") { 
    echo(
    "<img src=\"images/webLOL.bmp\"><center><br /><br /><img src=\"http://www.google.co.uk/intl/en_uk/images/logo.gif\"><form method=\"post\" action=\"roflcopter.php?page=search\">
    <br /><input name=\"whatisit\">
    <input type=\"submit\" value=\"Search!\">
    </form><br /><br />"
    );
    }
    if(
    $_GET ['page'] == "search") {

    $go stripslashes$_POST['whatisit'] );

    $_SESSION['search'] = $go;

    echo 
    "
    <img src=http://www.calonuk.net/images/webLOL.bmp><br />&nbsp;<table border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"0\">
        <tr>
            <td width=\"158\"><img src=http://www.calonuk.net/images/lolgle.bmp></td>
            <td><input value=\""
    $_SESSION['search'] ."\"></td>
        </tr>
        <tr>
            <td height=\"55\" colspan=\"2\" align=\"left\" valign=\"top\"><font face=\"Trebuchet MS\" size=\"3\">We could not find 
            any results for "
    $_SESSION['search'] ."</td>
        </tr>
    </table>"
    ;
    }
    ?>
    I made that cause' I was bored

    Hope it comes in handy

    ontopic: Hope the other code comes in handy.

Page 1 of 2 12 LastLast

Posting Permissions

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