234 users online (0 members and 234 guests)

# Thread: From 2 digits to 3 digits

Results 1 to 8 of 8
1. ## 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. ## 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.

3. ## 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. ## 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  ```

6. ## 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. ## 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. ## 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";}