Happy Codings - Programming Code Examples
Html Css Web Design Sample Codes CPlusPlus Programming Sample Codes JavaScript Programming Sample Codes C Programming Sample Codes CSharp Programming Sample Codes Java Programming Sample Codes Php Programming Sample Codes Visual Basic Programming Sample Codes

Php Programming Code Examples

Php > HTML and Php Code Examples

HTML color codes

HTML color codes <?php print "<html>"; print "<head>"; print "<title>HTML color codes</title>"; print "</head>"; print "</body>"; print "Enter the code per colors<br><br>"; print "<form action=\"htmlcolor.php?action=getcolor&red=$red&green=$green&blue=$blue\" method=\"post\">"; print "Red : <input type=\"text\" name=\"red\" size=\"10\" maxlength=\"40\"><br>"; print "Green : <input type=\"text\" name=\"green\" size=\"10\" maxlength=\"40\"><br>"; print "Blue : <input type=\"text\" name=\"blue\" size=\"10\" maxlength=\"40\"><br><br>"; print "<input type=\"submit\" value=\"Get color code\">"; print "<br><br><a href=\"index.html\">Main page</a> <a href=\"show_source.php? file=htmlcolor.php\">Show source</a>"; print "</form>"; print "</body>"; print "</html>"; if ($action=="getcolor") { if (empty($red)) { print "Enter a RED color"; exit(); } elseif (empty($green)) { print "Enter a GREEN color"; exit(); } elseif (empty($blue)) { print "Enter a BLUE color"; exit(); } print "Color code is:"; printf("<b>#%X%X%X</b>", $red, $green, $blue); } ?>