title: dynamically enabling/disabling a input text from controller
body: <p>I'm new in PHP and im using CI :D
  Now i have a view <code>user_form_v</code> and its controller <code>user</code>
  in my controller i tried to pass a string variable name <code>$validate</code> and i will validate it in my view with javascript, so if <code>$validate == add</code> i will enable my input text.
  This is my javascript(NOT WORKING) :</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
          function validation(){
              var temp = &lt;?php echo $validate?&gt;
              if (temp == "add")document.getElementById("id").disable = false;
          }
      &lt;/script&gt;
  </code></pre>
  
  <p>and this is my input text, the default is DISABLED :</p>
  
  <pre><code>&lt;input id="id" type="text" name="ID_user" class="text" disabled="disable"
                  value="&lt;?php echo (isset($user['ID_user']))?$user['ID_user']:""?&gt;"/&gt;
  </code></pre>
  
  <p><strong>ANSWER :</strong>
  According to the choosen answer, Javascript is no needed here(sorry im a noob) so all we need to do is add this : <code>&lt;?php if($validate!='add'){echo "disabled";} ?&gt;</code> this way, my input text will be disabled if they choose update.
  <strong>However it cant be work with <code>disabled="disabled"</code></strong>(I dont know why)
  So this is the final code for dynamic input text : <code>&lt;input type="text" name="ID_user" class="text"
                      &lt;?php if($validate!='add'){echo "disabled";} ?&gt;
                      value="&lt;?php echo (isset($user['ID_user']))?$user['ID_user']:""?&gt;"/&gt;</code></p>