PHP: Color mixing -
this stupid question i'm newbie in programming , can't figure out. want make color mixer in php. user can specify rgb values , color should appear.
i have this:
<html> <head> <title> rgb </title> <meta http-equiv="content-type" content="text/html; charset=utf-8"> </head> <body> <form method="get"> <center> <h3> rgb </h3> </center> <br> <h5> red </h5> <input type="range" name="red" min="0" max="255"> <h5> green </h5> <input type="range" name="green" min="0" max="255"> <h5> blue </h5> <input type="range" name="blue" min="0" max="255"> <br> <input type="submit" value="submit"> <br> <br> <?php $red=$ _get[ "red"]; $green=$ _get[ "blue"]; $blue=$ _get[ "green"]; function rgb2hex($red,$blue,$green) { return '#' . sprintf( '%02x', $red) . sprintf( '%02x', $blue) . sprintf( '%02x', $green); } rgb2hex($red,$blue,$green); ?> </form> </body> </html> but keep getting info undefined indexes , don't know how fix it.
the first run of file won't have $_get['xxx'] values initialized form not submitted. can check if form submittled this:
if (isset($_get['myformname'])){ //your code here } you can set name form , move php code without function inside of if.
Comments
Post a Comment