Welcome Guest, Not a member yet? Register   Sign In
Optional Default Value
#4

(This post was last modified: 02-28-2015, 07:40 PM by SomeGuy.)

This is how I handle "form field population", taylored to your specific case. Make of it what you will.

View file:

Code:
<input type="text" name="field_name" value="<?php echo htmlentities($post['field_name']) ?>">

In your controller...
Code:
...
function my_method() {
  $template_data = array(
    'post' => array(
      'field_name' => $this->session->userdata('logged_in')['first_name'],
    ),
  );

  if($this->input->post()) :
    $template_data['post'] = array_merge($template_data['post'], $this->input->post());
    // process form;
  endif;


  // render view with template variables
  $this->load->view('view-file', $template_data);
}

...
Reply


Messages In This Thread
Optional Default Value - by miiikkeyyyy - 02-28-2015, 09:24 AM
RE: Optional Default Value - by silentium - 02-28-2015, 01:00 PM
RE: Optional Default Value - by miiikkeyyyy - 03-01-2015, 06:08 AM
RE: Optional Default Value - by silentium - 03-01-2015, 04:11 PM
RE: Optional Default Value - by RobertSF - 02-28-2015, 04:49 PM
RE: Optional Default Value - by SomeGuy - 02-28-2015, 07:37 PM



Theme © iAndrew 2016 - Forum software by © MyBB