im creating a image generator with php and i have a problem.
I have a form that asks for color that's already defined
<select name="background color">
<option value=" 255, 0, 0">Red</option>
<option value="0,128,0">Green</option>
</select>
Once i select it and do my thing it gets stored in a variable with the POST method
?php
$height=$_POST['height'];
$width=$_POST['width'];
$cbackground=$_POST['backgroundcolor'];
$ctext=$_POST['text color'];
$text=$_POST['text'];
$arr = get_defined_vars();
header('Content-Type:image/jpeg');
$img = imagecreatetruecolor($width, $height);
imagefill($img, 0, 0, 255, 545, 543);
as you can see in the last line i hard coded a color, but what i want to acomplish is to call the value from the cbackground variable like this or similar.
imagefill($img, 0, 0, $cbackground);
when i do this i only get a little grey square, so it doesnt work as intended.
There is any way to make it work? properly?