• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
set_value with get

#1
Since Codeigniter 3.xx or before the set_value method has changed.

I have this in MY_form_helper

function set_value($field = '', $default = ''){
if (FALSE === ($OBJ =& _get_validation_object()))
{
if (isset($_POST[$field]))
{
return form_prep($_POST[$field], $field);
}
if(isset($_GET[field]))
{
return form_prep($_GET[$field], $field);
}
return $default;
}
return form_prep($OBJ->set_value($field, $default), $field);
}


In Codeigniter 3.xx it looks like this

function set_value($field, $default = '', $html_escape = TRUE)
{
$CI =& get_instance();

$value = (isset($CI->form_validation) && is_object($CI->form_validation) && $CI->form_validation->has_rule($field))
? $CI->form_validation->set_value($field, $default)
: $CI->input->post($field, FALSE);

isset($value) OR $value = $default;
return ($html_escape) ? html_escape($value) : $value;
}

can anybody help me rewrite it so it fixes my the get problem for my search input? and does the same as my prev code?

THX Big Grin ALOT
Reply


Messages In This Thread
set_value with get - by Hoxfoximper - 04-22-2016, 06:21 AM
RE: set_value with get - by Hoxfoximper - 04-22-2016, 09:40 AM
RE: set_value with get - by mwhitney - 04-27-2016, 07:56 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.