简体   繁体   中英

String display incorrectly when in codeigniter input value using the form helper

I have a strange issue I never had before. I have a record stored in my database, it is a dutch place name as follow:

's-Heer Abtskerke

if I use the form helper:

<div class="form-group">
    <?php
    echo form_label('Plaats','plaats');
    echo form_error('plaats');
    echo form_input('plaats',set_value('plaats',$object->plaats),'class="form-control" id="plaats"');
    ?>
</div>

I am getting this output:

&#039;s-Heer Abtskerke

And if I use the html input element:

<input type="text" name="plaats" class="form-control" id="plaats" value="<?php echo $object->plaats; ?>">

I get the correct output:

's-Heer Abtskerke

I am wondering what is going on in here!

You need to turn off html escape:

set_value('plaats','\'s-Heer Abtskerke', FALSE)

Here you have doc

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM