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!


Results 1 to 7 of 7
  1. #1
    Join Date
    Feb 2008
    Posts
    47
    Tokens
    0

    Default Search Button Help

    Hello habbox forum,

    Need some help
    I have a search engine script but im having a problem with the search buttons.



    WEB = Searches web.php
    UK = Trying to search uk.php (see below)

    At the momment the form will go to web.php But I have another script UK.php which I want to be selected when the user selects "UK Sites".

    Does anyone know how to do this as everytime I do this I keeps going to web.php regardless of what radio button is selected (web or UK sites).




    Moved by Hitman (Forum Moderator) from Technical Problems: Please post in the correct forum next time, thanks.
    Last edited by Hitman; 31-03-2008 at 04:57 PM.

  2. #2
    Join Date
    May 2005
    Location
    united kingdom
    Posts
    8,084
    Tokens
    595

    Latest Awards:

    Default

    I don't code however, I have used PHP in the past and perhaps it's an if function, sorry I can't help much.

    drink up this bottle of yeah
    and P A I N T your body on me


  3. #3
    Join Date
    Feb 2008
    Posts
    47
    Tokens
    0

    Default

    No worries, thanks anyway.

  4. #4
    Join Date
    Apr 2005
    Posts
    4,614
    Tokens
    90

    Latest Awards:

    Default

    Just do something like

    PHP Code:
    <?php
    $type 
    $_POST["type"];
    if(
    $type == "UK") {
    // Go to UK.php
    } else {
    // Go to whatever
    }
    ?>
    Obviously that won't really work because I don't know what your variables are called etc, but something like that.

  5. #5
    Join Date
    Jun 2005
    Posts
    2,688
    Tokens
    0

    Latest Awards:

    Default

    PHP Code:
    <script type="text/javascript">
    var 
    tempv '';
    function 
    change_submit(id) {

    if(
    id=='web') {
    document.getElementById('frmSearch').action 'web.php';
    }elseif(
    id=='uk') {
    document.getElementById('frmSearch').action 'uk.php';
    }

    return 
    true;
    }
    </
    script>

    <
    form method="POST" id="frmSearch" onSubmit="return change_submit(tempv);">
    <
    input type="text" name="search_text"><Br/>

    <
    input type="submit" onclick="document.tempv='web';" value="Web"> <input type="submit" onclick="document.tempv='uk';" value="UK">
    </
    form
    May need some adjusting

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

    Latest Awards:

    Default

    I would go with Bavings code, although if Javascript off you make it always go to web.php and just do Robbies code

  7. #7
    Join Date
    Mar 2008
    Posts
    5,108
    Tokens
    3,780

    Latest Awards:

    Default

    Quote Originally Posted by Baving View Post
    PHP Code:
    <script type="text/javascript">
    var 
    tempv '';
    function 
    change_submit(id) {

    if(
    id=='web') {
    document.getElementById('frmSearch').action 'web.php';
    }elseif(
    id=='uk') {
    document.getElementById('frmSearch').action 'uk.php';
    }

    return 
    true;
    }
    </
    script>

    <
    form method="POST" id="frmSearch" onSubmit="return change_submit(tempv);">
    <
    input type="text" name="search_text"><Br/>

    <
    input type="submit" onclick="document.tempv='web';" value="Web"> <input type="submit" onclick="document.tempv='uk';" value="UK">
    </
    form
    May need some adjusting
    I believe he wants to use the radio buttons though? Which I believe radio buttons handle onchange?

Posting Permissions

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