Welcome Guest, Not a member yet? Register   Sign In
escaping output in CodeIgniter
#6

Thanks Paul for your reply.

This way I can do the escaping in the controller itself.

Quote:$roles = $this->db->query($sql1, array($role_id));

$data['role'] = html_escape($roles->result_array());  

$this->load->view('edit_user',$data);


But I am displaying the form values in the view as fields of an object and hence I will have to change them as array fields.

For example:

Quote:<div class="form-inline input-group">
       <?php
foreach($role as $loop) 
{ ?>
<?php   
if(isset($CheckTask[$loop->id]))
echo  "<label class='checkbox inline'><input type='checkbox' name='role[]' value='$loop->id' checked />&nbsp; $loop->name &nbsp;</label>";
else
echo  "<label class='checkbox inline'><input type='checkbox' name='role[]' value='$loop->id' />&nbsp; $loop->name &nbsp;</label>";
}
?>
</div>

Using this code, I display a user's assigned roles. 

Now when I try to change object fields as array fields, I get syntax errors.
Reply


Messages In This Thread
escaping output in CodeIgniter - by june123 - 07-24-2017, 04:27 AM
RE: escaping output in CodeIgniter - by june123 - 07-24-2017, 08:00 AM
RE: escaping output in CodeIgniter - by PaulD - 07-24-2017, 10:56 AM
RE: escaping output in CodeIgniter - by june123 - 07-25-2017, 04:44 AM
RE: escaping output in CodeIgniter - by june123 - 07-25-2017, 10:31 PM



Theme © iAndrew 2016 - Forum software by © MyBB