I would like to request help on my code. Hope you understand my question.

This form will be shared public / social media

I created a cloud page with amp script.

Values on my smart capture are EMAIL (Primary Key), NAME and MOBILE.

My data extension name is 'Test_0930_Email' in which the answers are collected from my cloud page form. Values on my data extension are EMAIL, NAME and MOBILE

What I want is every time they answer AGAIN (using the same email address) from the form they will be redirected to a link (https://via.placeholder.com/300x300.png?text=SAMPLE).

Important Note: If they answer using a DIFFERENT EMAIL (Primary Key) the form will SUBMIT
If they answer the form again with the SAME EMAIL (Primary Key), it will redirect to https://via.placeholder.com/300x300.png?text=SAMPLE

Is the solution possible using amp script only? if yes, please help me fix my code.

My Amp script in Cloudpage:

Set @EMAIL= RequestParameter ('EMAIL')
Set @NAME= RequestParameter ('NAME')
Set @MOBILE= RequestParameter ('MOBILE')

SET @STATUS = Lookup('Test_0930_Email', 'EMAIL', @EMAIL)

1 Answer 1


Try this, seems you almost got it right.

Paste this at the very top of your CloudPage, somewhere above the Smart Capture form:


And place this somewhere at the end of the CloudPage, after the Smart Capture form:


What the above code does:

  1. Checks if the email of the visitor of your CloudPage exists already in your target DE
  2. If their email exists in the DE, they get redirected to the link you specified
  3. If their email is not present in your DE, it displays the Smart Capture form. That’s why you have to put the ending of the conditional statement after the form.

I have deleted the email, mobile and name declarations, because they are not needed for this bit of code. Feel free to re-add them if you need them for something else, but remember that in order for them to work, you need to correctly pass them from the email using the CloudPagesURL function: https://ampscript.guide/cloudpagesurl/

  • Hi @zuzannamj, Thanks on the code you gave, much appreciated. But after answering the form using the SAME EMAIL, the form SUBMITS instead of going to the said link (via.placeholder.com/300x300.png?text=SAMPLE) Here is a screenshot: ibb.co/Z8pk2FR
    – Harvey
    Oct 4, 2021 at 1:20
  • Also forgot to mention that this form doesn't come from an EMAIL. This form will be shared on a social media platform. Here is a screenshot of the Smart capture I did: ibb.co/Z8pk2FR
    – Harvey
    Oct 4, 2021 at 1:26
  • If this form is for unknown users, you won't be able to use Smart Capture for your use case, you should create an HTML from scratch to address this, as you cannot really control any post-submit actions with a Smart Capture form. Here's a tutorial on creating forms in Cloud Pages: sfmarketing.cloud/2019/09/22/…
    – zuzannamj
    Oct 4, 2021 at 7:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .