38 users online (0 members and 38 guests)  


  Results 1 to 8 of 8

Related

  1. Replies: 5
  1. #1
    bertugolu's Avatar
    New User

    Status
    Offline
    Join Date
    Mar 2007
    Posts
    15

    Question From 2 digits to 3 digits

    How can i have a number (like 43) and make it 043?

    Or have a letter A and make it 0A?

  2. #2
    vinyl-junkie's Avatar
    Moderator

    Status
    Offline
    Join Date
    Sep 2005
    Posts
    721

    Re: From 2 digits to 3 digits

    You could use a scripting language such as javascript or PHP to create that effect. It would be helpful if you'd supply a little more detail as to what problem you're trying to solve. Then we could offer a more detailed solution.
    Music Around The World - Collecting tips, trade
    and want lists, album reviews, & more

  3. #3
    bertugolu's Avatar
    New User

    Status
    Offline
    Join Date
    Mar 2007
    Posts
    15

    Fixing

    I did this,

    PHP Code:
    If ($dec2hexvaru1 == "1")
    {
    $dec2hexvaru1 "0".$dec2hexvaru1."";
    }
    elseif( 
    $dec2hexvaru1 == "2")
    {
    $dec2hexvaru1 "0".$dec2hexvaru1."";
    }
    elseif( 
    $dec2hexvaru1 == "3")
    {
    $dec2hexvaru1 "0".$dec2hexvaru1."";
    }elseif( 
    $dec2hexvaru1 == "4")
    {
    $dec2hexvaru1 "0".$dec2hexvaru1."";
    }elseif( 
    $dec2hexvaru1 == "5")
    {
    $dec2hexvaru1 "0".$dec2hexvaru1."";
    }elseif( 
    $dec2hexvaru1 == "6")
    {
    $dec2hexvaru1 "0".$dec2hexvaru1."";
    }elseif( 
    $dec2hexvaru1 == "7")
    {
    $dec2hexvaru1 "0".$dec2hexvaru1."";
    }elseif( 
    $dec2hexvaru1 == "8")
    {
    $dec2hexvaru1 "0".$dec2hexvaru1."";
    }elseif( 
    $dec2hexvaru1 == "9")
    {
    $dec2hexvaru1 "0".$dec2hexvaru1."";
    }elseif( 
    $dec2hexvaru1 == "A")
    {
    $dec2hexvaru1 "0".$dec2hexvaru1."";
    }elseif( 
    $dec2hexvaru1 == "B")
    {
    $dec2hexvaru1 "0".$dec2hexvaru1."";
    }elseif( 
    $dec2hexvaru1 == "C")
    {
    $dec2hexvaru1 "0".$dec2hexvaru1."";
    }elseif( 
    $dec2hexvaru1 == "D")
    {
    $dec2hexvaru1 "0".$dec2hexvaru1."";
    }elseif( 
    $dec2hexvaru1 == "E")
    {
    $dec2hexvaru1 "0".$dec2hexvaru1."";
    }
    elseif( 
    $dec2hexvaru1 == "F")
    {
    $dec2hexvaru1 "0".$dec2hexvaru1."";


  4. #4
    bertugolu's Avatar
    New User

    Status
    Offline
    Join Date
    Mar 2007
    Posts
    15

    Re: From 2 digits to 3 digits

    sorry, by mistake i created a new thread...
    PHP Code:
    http://www.ahfb2000.com/webmaster_help_desk/showthread.php?t=7156 

  5. #5
    HTML's Avatar
    Administrator

    Status
    Offline
    Join Date
    Aug 2000
    Posts
    3,445

    Follow HTML On Twitter Add HTML on Facebook Add HTML on Google+ Add HTML on Linkedin Visit HTML's Youtube Channel

    Re: From 2 digits to 3 digits

    Thread merged
    AHFBWEB Less customers per server, more power for you!

    Business Class Shared Hosting

  6. #6
    DeadMeatGF's Avatar
    Moderator

    Status
    Offline
    Join Date
    Sep 2005
    Posts
    381

    Re: Fixing

    @bertugolu
    Why?
    PHP Code:
    $var substr("00".$var, -2
    will work just as well, and far more simply - or
    PHP Code:
    $var substr("000".$var, -3
    for the original question.

  7. #7
    bertugolu's Avatar
    New User

    Status
    Offline
    Join Date
    Mar 2007
    Posts
    15

    Re: From 2 digits to 3 digits

    as you can see, i am quite a beginner in this aspect. 10q for you help. Now can you tell me how to make a field mandatory?

  8. #8
    bertugolu's Avatar
    New User

    Status
    Offline
    Join Date
    Mar 2007
    Posts
    15

    Re: From 2 digits to 3 digits

    also another thing..how can i make an if fuction that relies on this concept?

    if ($a=$b=$c=$d); (and so on)
    {echo "hello";}
    else {echo"goodbye";}



Tags for this Thread