Add and confirm before submitting

3 posts by 2 authors in: Forums > CMS Builder
Last Post: May 18, 2015   (RSS)

By Dave - May 18, 2015

Hi Tim, 

It takes a bit of coding but basically it's very similar to when there are errors on a form and you re-display all the last entered values.   What you do is always submit the form to a preview.php page and have that redisplay the submitted values AND also create hidden fields with them to pass them forward for the final submit.

Here's some example code we use on the forum preview page.  

<form method="post" action="?">
<?php foreach ($_REQUEST as $key => $value): ?>
<input type="hidden" name="<?php echo htmlspecialchars($key) ?>" value="<?php echo htmlspecialchars($value) ?>">
<?php endforeach ?>

<div class="sforum-buttons">
<input type="submit" name="x" value="Back" />
<input type="submit" name="previewAccepted" value="<?php echo $PREVIEW['button_label'] ?>" />
</div>

Hope that makes sense and helps!  Let me know any questions.  Thanks!

Dave Edis - Senior Developer
interactivetools.com

By Toledoh - May 18, 2015

Thanks Dave - it may be something I get you guys to do for me - but I'll have a crack.

Cheers,

Tim (toledoh.com.au)