I have an HTML & CSS Landing Page where my goal is when the customer click on the button: he will populate a Data Extension and new window will open in the same tab:

<button class="button button2" style="float:right" 
name="unsub" type="hidden" value="true">Unsubscribe</button>

The AMPscript:

IF NOT EMPTY(RequestParameter("unsub")) THEN
SET @SubKey = RequestParameter("subkey")
SET @email = RequestParameter("E-mail")

The problem is that when i tried to put the HTML form action the link open, but the Data Extension not populate.


I hope your AMPscript part is correct...And only have trouble in HTML section. As I dont see full code, I have tried to simulate the demo, and the below worked fine. Please try to compare with the below and figure out.

IF NOT EMPTY(RequestParameter("unsub")) THEN
SET @SubKey = RequestParameter("subkey")
SET @email = RequestParameter("email")
UpsertData('2019DEC21_Demo',1,'SubKey',@subkey,'E-mail',@email) //change your DE Name
Redirect(concat("https://salesforce.stackexchange.com?subkey=", @SubKey))

<!DOCTYPE html>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<h1 style="color:maroon; text-align:center;">SF-StackExchange Demo</h1>

<form id="myform" action="%%=RequestParameter('PAGEURL')=%%" method="post" target="_blank">
<input type="text" name="email">
<input type="text" name="subkey">
<input name="unsub" type="hidden" value="true"/>
<input type="submit" value="Unsubscribe"/>


And I also verified it Upsert the DE. enter image description here

|improve this answer|||||
  • Hello @Vishal. But when do you click in your button whant happens? I think i'm not clear, i want that when you click in the button, another page opens (url) and DE be populated – Joao Marano Dec 22 '19 at 18:06
  • As of now the above code updates the Data Extension and stays in same page... If you wish you can redirect it once submitted... If you provide the URL I can demonstrate... Hope I'm clear. – Vishal Kumar C V Dec 22 '19 at 18:13
  • For my if you could help me kindly you can use the salesforce.stackexchange.com – Joao Marano Dec 22 '19 at 22:49
  • Hi @JoaoMarano I have updated the code, please check...FYI I have added below code...... target="_blank and Redirect(concat("https://salesforce.stackexchange.com?subkey=", @SubKey)) – Vishal Kumar C V Dec 23 '19 at 8:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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