confirm page with form result in cakephp
hi i am making a form with a confirm page where I would like to display what was input from the form and give the user a chance to check it before sending it in.
I have successfully done this by saving the form elements in the session:
$this->Session->write('Visitor.confirm', $this->data);
and get it by:
<? $fields = $this->Session->read('Visitor.confirm')?>
<?php echo $fields['Visitor']['v_firstname']; ?>
<?php echo $this->Form->hidden('v_firstname', array('value'=> $fields['Visitor']['v_firstname开发者_如何转开发']));?>
....for each field. but i cannot get the fields to send as a new form? there must be a simpler way!
many thx
Is the 'confirm' button a submit button within your form with all your hidden fields? Or do you have it as a good old fashioned link, and hoping that it submits your hidden form data?
Is there a reason why you would not grab the values out of the session on the page after confirmation, as opposed to resubmitting everything in a hidden form?
you don't have to post the form again. When user clicks confirm, and a confirm() action is called, you just have to save what's in $this->Session->read('Visitor.confirm');
精彩评论