WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a simple contact form using CONTACT FORM 7 PLUGIN on a page on my site. I want user to be able to download a video file only after he/she fills out the form and the form submission is successful. How do i check whether the form is successfully submitted so that I can then put in the code for force download of the file?


migration rejected from stackoverflow.com Jul 28 '14 at 14:29

This question came from our site for professional and enthusiast programmers. Votes, comments, and answers are locked due to the question being closed here, but it may be eligible for editing and reopening on the site where it originated.

closed as off-topic by birgire, kaiser Jul 28 '14 at 14:29

This question appears to be off-topic. The users who voted to close gave this specific reason:

If this question can be reworded to fit the rules in the help center, please edit the question.

up vote 3 down vote accepted

In Additional Settings, use on_sent_ok: "location = 'http://example.com/';" to redirect to another page, but as said above, it's not that secure. You can hide the page via robots.txt.


You need some variable to let this page know if it's successful or not. With-in a conditional statement would go your link to download the video. This might involve a custom template page, or some sort of custom shortcode to implement.

You might name a variable like "$showVid".

from there , use the on_sent_ok: "location = 'http://example.com/'; where the 'example.com' is a dummy page ( for lack of better terms ) that simply redirects back to the contact form page, now with a POST variable in place.

Assign that variable to let you page know it's time to show the hyperlink.

$showVid = isset( $_POST['success'] );

*I'm not sure how to or if you can send POST data back with wp_redirect, perhaps that's another question that could be found/answered on here.*

Alternatively you might use a cookie to let your browser know.

now in doing this you still might want to do the redirect thing, but this time your not sending variable back from the dummy page, your just basically refreshing the page real quick, and then back with a cookie set.

now assign this same variable from the cookie.

$showVid = isset( $_COOKIE['success'] );

you conditional might be something such as :

if($showVid)  _( 'code for download link ' ) ;

You've probably gotten this all figured out by now, but for everyone else who visits this page... change the message for "# Sender's message was sent successfully" to be a link to your video. Simple, and ONLY displays if the sender submits the form.


If I remember correctly Contact Form 7 has the option to redirect to a success-page after the visitor clicks the submit-button.

Although you would have to make sure to hide that particular success-page from the rest of the site, in order to prevent people "accidentally" reaching that page, you could use that as a setup, as the only way reaching the success-page is after a successful form submission.


Well, i want a link to appear on the same page below the contact form after successful submission of the contact form. Link should say Download your video 'here' where 'here' should be a hyperlink clicking on which starts the force download of the video.

So i want to check whether form was successfully submitted and only then the download link should apper. How do i do this?

Your post is not an Answer, yet you posted as an answer. – Rev. Voodoo Aug 9 '11 at 19:15

Not the answer you're looking for? Browse other questions tagged or ask your own question.