Add and confirm before submitting

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

By Toledoh - May 13, 2015

Hi all,

I'm trying to build a recipe submission module.  Simple enough form with image upload, however, (like this forum) I want to add a "preview" screen with edit or submit buttons.

Any suggestions on how I progress it?

I've attached my basic form.

Cheers,

Tim (toledoh.com.au)
Attachments:

submit.php 6K

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