title: How to prevent the user from changing values in the HTML or the JavaScript
body: <p>I am trying to make a user can change they are changing profile text color and background color. </p>
  
  <p>I created this <strong><a href="http://codepen.io/shadowman86/pen/LEQdwB" rel="nofollow">DEMO</a></strong> from codepen.io </p>
  
  <p>In this demo you can see when you checked any radio button then <code>.colored-text</code> div inside text will changing automatically. </p>
  
  <p>I want to allow only that color:  <code>#fa743e,#323949,#0000,#d8dbdf</code>. But the problem is here if user change for example <code>#fa743e</code> to <code>#ffffff</code> using developer console the <code>#ffffff</code> color posting  in database. It is not good.</p>
  
  <p>this is form :</p>
  
  <pre><code>&lt;form method="post" action=""&gt;
  &lt;!--Text Color--&gt;
  &lt;div class="renk"&gt;
    &lt;input type="radio" id="red" class="sr ja" name="change-text-color" value="#fa743e"&gt;
    &lt;label for="red" class="llr"&gt;&lt;/label&gt;
  &lt;/div&gt;
  &lt;!--Background Color--&gt;
  &lt;div class="renk"&gt; 
     &lt;input type="radio" id="lr" class="lr ja" name="change-background-color" value="#000000"&gt;
     &lt;label for="lr" class="llr"&gt;&lt;/label&gt;
  &lt;/div&gt;
  
  &lt;/form&gt;
  </code></pre>
  
  <p>I am using this ajax post method:</p>
  
  <pre><code>$.ajax({
       type: "POST",
       url: 'change_theme.php',
       data: {change-text-color:$('input[name="change-text-color"]:checked').val(),change-background-color:$('input[name="change-background-color"]:checked').val()},
       beforeSend: function(){$("#posting").html('&lt;img src="icons/ajaxloader.gif"/&gt;'); },
       success: function(html) {
       $('.tduzalani, .temayi-degistir-alani').animate({'opacity':'0'}, 300, 'linear', function(){
       $('.tduzalani, .temayi-degistir-alani').css('display', 'none');});
          swal({   title: "Theme was changing succuesfully!",   text: ":)",   timer: 5000 });
        }
  });
  </code></pre>
  
  <p>and this is <strong>change_theme.php</strong></p>
  
  <pre><code>&lt;?php
  include_once 'includes.php';
  $colors = array( '#fa743e','#ffcc4d','#94d487','#4a913c','#89c9fa','#3b94d9','#abb8c2','#dd2e44','#f5abb5','#bfcfee','#be72ea','#ea729f','#000000','#0e1d40','#0e4034','#40310e','#451468','#ffffff','#006cff','#bb0707','#660202','#44404b','#422929','#323949');
  if((isSet($_POST['change-text-color']) &amp;&amp; in_array($_POST['change-text-color'], $colors)) || (isSet($_POST['change-change-background-color']) &amp;&amp; in_array($_POST['change-background-color'], $colors)))
  {
  $text-color=mysql_real_escape_string($_POST['change-text-color']);
  $background-color=mysql_real_escape_string($_POST['change-background-color']);
  
  $data=$Suavi-&gt;change_theme($uid,$text-color,$background-color);
  
  }
  ?&gt;
  </code></pre>