The Community is hosting an End of Summer sweepstakes! Participants must complete tasks to earn tickets that will enter them with a chance to win a free year of Constant Contact and other great prizes!*
*No Purchase Necessary. For Official Rules, visit here. Constant Contact’s End of Summer 2020 Sweepstakes ends on October, 20, 2020 at 11:50 PM EST.

Clear Window after submitting data

Highlighted
Participant

Clear Window after submitting data

Hi,


I'm using the PHP samples (Edit Contact step 1) and (Edit Contact).


After the custustomer enters a new e-mail address then (Edit Contact) paints the new form for the customer to complete just below the original form, which asked for his e-mail address. 


How can I tell program in effect, clear the screen of the orignial form, and just display the new form?


TIA - Tom

3 REPLIES 3
Highlighted
Employee

Clear Window

Hi Tom,


 


I may need some clarification on what you are looking for in order to answer your questions. Are you looking for the edit_contact.php page to show none of the contact details for the contact you edited after the form is submitted? Or are you looking for the add_contact.php page to clear out the form fields after a contact is submitted, so that you can immediately add another contact without having to clear out the previously added contacts details?


 

David J

Highlighted
Participant

Hi David,   There are a

Hi David,


 


There are a couple places where this occurs, and for your reference here is a link to our sign up page: http://jmcserv.com/ipad/


 


It starts asking for the contacts e-mail address (basically script Edit Contact Step 1)


 


And after the contact finishes the form, and he successfully adds his name to the database, he gets a "successfully added message", but (here is the problem I'd like to solve) all the original forms are still displayed.


 


What I'd like to have happen, is to remove all the forms and have a clean page with only the message "Congrats you have added you name blah, blah, blah..."


 

Highlighted
Employee

Clear Contents

There are a few different ways you could modify the php sample files in order to do this, and which is best is going to depend on the flow of your site and the expected user experience that you are looking for.


 


1. You could wrap the form portion of these pages in an if statement only to be displayed if the form is not submitted, that way it is only displayed until the form is actually submitted. Once the form is submitted, that portion of the page would no longer display as the POST array is not empty. This would work for keeping uses on the same page after submitting the form without actually showing it to them.


 


2. You could also add header('Location: http://www.yourdomain.com/successpage.html') instead of displaying the normal success message. This way when the form is submitted and a contact is successfully created, they would be moved to a specific page designed to handle the successful submission of the form.  You could then use this page to display the success message and any other elements you feel are necessary upon creating or editing a contact.

David J

Developer Portal

View API documentation, code samples, get your API key.

Visit Page

Constant Contact 2020 End of Summer Community Sweepstakes!

The Constant Contact User Community is hosting a sweepstakes. The more you participate, the more chances you have to win! Read on to learn more...

Read More
Featured