View Full Version : Showing a div after form submits successfully
gwh362692
10-31-2009, 09:51 PM
Hi everyone,
In the Universal Email wizard you can set a goto page where it redirects to once the form is submitted successfully. Instead of this, I wanted to just show a box (ie. div#confirm) with a confirmation message. This would need to be hidden until the form was submitted and then shown after it was sent successfully.
Has anyone done this before and if yes, can you explain how I'd do it?
Appreciate any help.
Jason Byrnes
11-02-2009, 09:36 AM
set the redirect page to go to the same page universal email is on and pass querystring variable:
page.php?sent=true
then put a PHP if statement around the confirm div:
<?php if(isset($_GET['sent']) && $_GET['sent'] == "true") { ?>
<div class="confirm">Your message</div>
<?php } ?>
gwh362692
11-02-2009, 01:41 PM
Thanks for the reply,
So I set the go to page to contact.php then clicked the lightning icon to go into the select data bindings dialogue. I'm not sure though how to pass the querystring variable you mentioned. The following code is in the code field:
<?php echo((isset($_POST[""]))?$_POST[""]:"") ?>
Do I go:
<?php echo((isset($_POST["page.php?sent=true"]))?$_POST[""]:"") ?>
Sorry, still trying to learn php syntax.
Jason Byrnes
11-02-2009, 02:00 PM
No, just set the redirect to:
contact.php?sent=true
gwh362692
11-03-2009, 03:40 AM
Thanks - everything's working now.
troyd
11-10-2009, 01:25 PM
Jason,
If I wanted to also add the person's name what would I include in order to echo that which was entered into the text field?
I have "Thank You" now in the show if statement. I would like to include their name. I've tried several things but it's not catching it.
Oh and hide the form at the same time.
Thanks,
TroyD
Jason Byrnes
11-10-2009, 03:35 PM
If the form element they enter their name is "name", set the message to:
Thank You <?php echo((isset($_POST["name"]))?$_POST["name"]:"") ?>
To hide the form, place an if statement around it:
<?php if(!isset($_GET['sent']) || (isset($_GET['sent']) && $_GET['sent'] != "true")) { ?>
<from...>
......
</from>
<?php } ?>
troyd
11-10-2009, 03:52 PM
Yes, that first one is what I have been trying. My field name is "fieldset_group_Name"
So my entire show if is
<?php if(isset($_GET['sent']) && $_GET['sent'] == "true") { ?>
<div class="confirm">Thank You<?php echo((isset($_POST["fieldset_group_Name"]))?$_POST["fieldset_group_Name"]:"") ?><br />
We will reply shortly. </div>
<?php } ?>
But I'm not getting a result. It does show "Thank You, We will reply shortly".I must have something else wrong.
The hide form worked great however.
Thanks,
TroyD
Jason Byrnes
11-10-2009, 04:38 PM
Oh, right, the redirect is killing the POST collection.
set the redirect to:
contact.php?sent=true&email=<?php echo((isset($_POST["fieldset_group_Name"]))?$_POST["fieldset_group_Name"]:"") ?>
This way the posted email address is captured into the get collection.
then set the display to:
<?php if(isset($_GET['sent']) && $_GET['sent'] == "true") { ?>
<div class="confirm">Thank You<?php echo((isset($_GET["email"]))?$_GET["email"]:"") ?><br />
We will reply shortly. </div>
<?php } ?>
troyd
11-10-2009, 06:40 PM
Jason,
That did the trick. Thanks.
I can't wait until I can see these things for myself. Until then, I'm glad I have help here.
TroyD
vBulletin® v3.8.1, Copyright ©2000-2012, Jelsoft Enterprises Ltd.