<?php echo $user->profile_fields['firstname']; ?> <div class="control-group"> <?php echo Form::label('Ime', 'firstname', array('class'=>'control-label')); ?> <div class="controls"> <?php echo Form::input('firstname', Input::post('firstname', isset($user->profile_fields['firstname']) ? $user->profile_fields['firstname'] : ''), array('class' => 'span4')); ?> </div> </div>
<input name="test" type="text" value="<?=$user->profile_fields['firstname']?>">UPDATE 1: I went debugging From::input method and some of my from value string characters gets converted into html entities after calling $attributes = static::prep_value($attributes)!
if (\Config::get('form.prep_value', true) && empty($attributes['dont_prep'])) { $attributes['value'] = static::prep_value($attributes['value']); unset($attributes['dont_prep']); }
echo $user->profile_fields['firstname'] . ' ' . $user->profile_fields['lastname']; echo '<br>'; $test = serialize(array('firstname'=>'Urška', 'lastname'=>'Neumüller')); var_dump($test); echo '<br>'; $test2 = unserialize($test); var_dump($test2); echo '<br>'; echo '<input type="text" value="'.$test2['firstname'].'">'; echo '<input type="text" value="'.$test2['lastname'].'">'; echo '<br>'; echo '<input type="text" value="'.htmlspecialchars($test2['firstname']).'">'; echo '<input type="text" value="'.htmlspecialchars($test2['lastname']).'">'; echo '<br>'; echo '<input type="text" value="'.$user->profile_fields['firstname'].'">'; echo '<input type="text" value="'.$user->profile_fields['lastname'].'">'; echo '<br>'; echo '<input type="text" value="'.htmlspecialchars($user->profile_fields['firstname']).'">'; echo '<input type="text" value="'.htmlspecialchars($user->profile_fields['lastname']).'">';
Thinking about it, I think the issue here is double encoding. FuelPHP by runs Security::htmlentities() by default on all data send to a view, unless you disable that. This is a security measure. But Form::Input() calls prep_value(), which also calls Security::htmlentities(), causing the value to be encoded twice. By default PHP's htmlentities() will also double encode. For the Security class, I've commited a fix for this a few days ago that will disable double encoding by default.
It looks like you're new here. If you want to get involved, click one of these buttons!