Im working at a profile page and want to add a 'favorite color' button. So this is the code I used in my view:
<span class="form-label">Your favorite color:</span>
<input id="my_color" type="color"/>`<span class="form-label">
So on the profile page the 'color picker' is visible.
This is the save function in my javascript. (it works for the other profile options.
var saveChanges = function ()
{
var jsonData = {};
$('#user_info input').each(function () {
var key = $(this).attr('id');
var value = $(this).val();
jsonData[key] = value;
});
I can save the color I picked and if I look it up in my database (my_color) I see the hex color code I picked so that is working. But after I save my profile and I refresh the page you still see the default (black) color and not the color I picked before saving.
Can someone help me to show the color on the profile page.
Thanks
I guess is can happen because of two reasons:
<input type="color" id="theId" value="#<some php code to get the value>" />
Hope it helps, Regards
Im sorry guys I made a mistake. In my databse column I limited the characters to 6. I forgot # is also a character so I had to do char(7) Now it works! Still thanks for your help and answers.