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 6 of 6

Thread: Check box

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

    Latest Awards:

    Default Check box

    When I use a checkbox which isn't checked, it dosn't post it at all.
    When its checked, the value is 1, but how do I make it so when its not checked its value is 0?

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

    Latest Awards:

    Default

    Quote Originally Posted by Jack120 View Post
    When I use a checkbox which isn't checked, it dosn't post it at all.
    When its checked, the value is 1, but how do I make it so when its not checked its value is 0?
    Mighty question.

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

    Latest Awards:

    Default

    You mean like:

    PHP Code:
    <?php
    $checkbox 
    $_POST["checkbox"];
    if(
    $checkbox !== "1") {
    // do nothing
    } else {
    echo(
    'You ticked it.');
    }
    ?>
    ?

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

    Latest Awards:

    Default

    Quote Originally Posted by RROD View Post
    You mean like:

    PHP Code:
    <?php
    $checkbox 
    $_POST["checkbox"];
    if(
    $checkbox !== "1") {
    // do nothing
    } else {
    echo(
    'You ticked it.');
    }
    ?>
    ?
    Im using:
    PHP Code:
    if(isset($_POST["tos"])) { 
    so if its not posting it, then the event wont work

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

    Latest Awards:

    Default

    Quote Originally Posted by Jack120 View Post
    Im using:
    PHP Code:
    if(isset($_POST["tos"])) { 
    so if its not posting it, then the event wont work
    Do this:

    PHP Code:
    if(isset($_POST["tos"])) { 
    echo 
    "You're cool, jeez.";
    {
    else { 
    echo 
    "You killed it, jeez.";
    exit();

    ..

    Otherwise try some javascript

  6. #6

    Default

    I think that's controlled by the browser, as check-box's were designed for multiple rows, making it more of a "choose-box" (if you buy something from a shop, you would say "I want that", not "I want that one, but not that one, and not that one, and not that one...".

    To make the value "0", you can use something like:

    Code:
    <?php
    $input=$_POST['tos'];
    
    if (empty($input))
         $input=0;
    
    ?>

Posting Permissions

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