也许是这样的:
// load first form data here, then:
$data = '...';
// this is intentionally above the first form
if ($this->session->userdata('step_1') == 'done' AND is post action) {
if(the second form is validated, then) {
// unset the session here
$this->session->unset_userdata('step_1');
}
}
if ($this->session->userdata('step_1')!=='done' AND is post action ) {
if(the first form validates here, then) {
$this->session->set_userdata('step_1', 'done');
// prepare the second form data here, that will override the one above:
$data = '...';
}
}
请注意,我有一段时间没有使用 CI,所以我真的不记得那里的所有对象名称,但你应该明白这一点。