Welcome Guest, Not a member yet? Register   Sign In
Update Form Validation
#2

[eluser]Jaketoolson[/eluser]
Within the controller you should do the DB vs $_POST comparison/processing/merging of the results then pass a results array to the view.

Here's a very bland example:
Code:
// $options = the DB array.
// $_POST = the $_POST array.  
// array_merge will overwrite existing key->value pairs (if they exist).

$options = array('ridetime' => '2 hours', 'distance' => '26 miles');
$_POST = array('distance' => '28 miles', 'ridedate' => '2011-02-01');

$data = array_merge($options,$_POST);

// $data outputs the following array:
array (
  'ridetime' => '2 hours',
  'distance'  => '28 miles',
  'ridedate'  => '2011-02-01'
)

$this->load->view('update', $data);

As it pertains to form validation rules, you can create an array with rules and use them throughout the site. See 'Setting Rules Using an Array'.


Messages In This Thread
Update Form Validation - by El Forum - 02-24-2011, 11:21 AM
Update Form Validation - by El Forum - 02-24-2011, 12:33 PM
Update Form Validation - by El Forum - 02-24-2011, 01:12 PM
Update Form Validation - by El Forum - 02-25-2011, 01:07 PM
Update Form Validation - by El Forum - 02-25-2011, 05:20 PM
Update Form Validation - by El Forum - 02-25-2011, 05:31 PM



Theme © iAndrew 2016 - Forum software by © MyBB