0
I’m trying to create a Date field in codeligniter for the user to inform Data, I created a helper file with the date code (actually I used a code that was helpful to another question on this site), but I’m not able to use. I have some questions about the code, 1º After loading the helper in my controller I am loading the method created to format date in a variable in which I call it in the view, I am doing it the right way? 2º when I perform test the date I typed in the form, I give a vardump to test what returns me, and returns NULL. 3º What is the syntax of the native function of the codeigniter _parse_form_attribute, the manual of the codeigniter this out has a few days and I am not able to give continuity to my project.
//HELPER
if ( ! function_exists('form_common')){
function form_common($type = 'text', $data = '', $value = '', $extra = '')
{
$defaults = array('type' => $type, 'name' => (( ! is_array($data)) ? $data : ''), 'value' => $value);
return "<input "._parse_form_attributes($data, $defaults).$extra." />";
}
}
if ( ! function_exists('form_date')){
function form_date($data = '', $value = '', $extra = '')
{
return form_common($type = 'date', $data = '', $value = '', $extra = '');
}
}
//CONTROLLER REALIZEI TESTE PARA VER O QUE ESTA ME RETORNANDO APÓS DIGITAR A DATA E CLICAR NO BOTÃO, MAS O RESULTADO É NULL
if(isset($_POST['acao']) && $_POST['acao'] == 'Abrir Agenda >>'){
$data = $this->input->post('data');
echo 'A data Informada é '.$data;
var_dump($data);
}
//VIEW
echo form_date('data', 'data');
HOW DO I ADD A NAME TO THIS DATE FIELD AND CALL IT AGAIN TO ASSIGN ITS VALUE TO A VARIABLE.
My question is described correctly?
– sol25lua