View Single Post
Old 03.11.2006, 08:43   #20
Kenjiro
Архивный участник
 
Join Date: Apr 2006
Posts: 120
Default

Quote:
Originally Posted by GMan View Post
Thank you, i just figured that out using http://www.shodor.org/stella2java/rgbint.html and seeing that some programs use GBR
You could use that to save value to database:
Code:
$color_rgb= ( hexdec ( substr ( $_GET [ "name_color" ], 0, 2 ) ) + ( hexdec ( substr ( $_GET [ "name_color" ], 2, 2 ) ) << 8 ) + ( hexdec ( substr ( $_GET [ "name_color" ], 4, 2 ) ) << 16 ) );
and this to show in form field:
Code:
printf ( "%02X%02X%02X", $color_rgb & 0xff, ( $color_rgb & 0xff00 ) >> 8, ( $color_rgb & 0xff0000 ) >> 16 );
Kenjiro is offline