Thread: Color picker
View Single Post
  #2  
Old 08-26-2018, 07:12 PM
Dinocanid's Avatar
Dinocanid Dinocanid is offline
Member
 
Join Date: Aug 2016
Location: Maryland, USA
Posts: 516
Gender: Unknown/Other
Credits: 64,923
Dinocanid is on a distinguished road
Default

You could use a color picker with an HTML form, like:
PHP Code:
$document->add(new Comment("<form action='PAGENAME' method='post'>
<input type='color' id='color' name='color' value='#e66465' />
<button id='submit' value='submit' name='submit type='submit'>Pick Color!</button>
</form>"
)); 
Replace PAGENAME with the whatever page you use this on. If used in blankview.php for example, you would replace it with "blank".

To get the data from the form, use this:
PHP Code:
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
            
$mycolor $_REQUEST['color'];
            
$document->add(new Comment("The color you picked was {$mycolor}!"));
//a database statement could also go here if you want to store the chosen color
            
return;
        } 
That's just getting the color though. I'm not entirely sure how to apply the chosen color to pets.
__________________
Reply With Quote