Color picker

Forum
Last Post
Threads / Messages

Milly Money

Pet-Sim.Online
Staff member
Dev Staff
Joined
Jan 27, 2010
Messages
538
Points
18
Mysidian Dollar
28,331
Does anyone know a simple way to use color picker with the latest version?

I want to use that to change colors on bases.



I've never gotten the hang of CP, sadly!
 
You could use a color picker with an HTML form, like:
PHP:
$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:
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.
 
I might be able to work that out. :)

Thank you so much, I appreciate the tips!
 

Similar threads

Users who are viewing this thread

  • Forum Contains New Posts
  • Forum Contains No New Posts

Forum statistics

Threads
4,277
Messages
33,119
Members
1,602
Latest member
BerrieMilk
BETA

Latest Threads

Top