[SalesForce] exacttarget AMP or SSJS exacttarget..landing page : part 2

I am Putting the same question here which was confusing in earler one :
exacttarget AMP or SSJS exacttarget..landing page

my requirement and how to proceed.

1.First Landing page(LP1) which contains just an email text field,a submit button and a link. The customer-care person enter email to check if the subscriber exist in DE (based on email). And also a direct link to create new subscriber in DE under it.

2.Next, both button and link leads to same LP2 where there is a subscriber form with pre-filled subscriber data to be updated if the email exist in DE.OR an empty subscriber form to create a new subscriber in DE if the email doesn't exist in DE.

I followed the recommendation answer from Mr. Timothy(https://salesforce.stackexchange.com/a/32775/7804) and successfully able to finish till point 3, where i could able to have form prefilled with existing customer data in my LP2 form page.

But now i need pointers for point4 i.e i need to create and update the customer date in DE on submit button … Thx in advance !!

EDIT

I Tried the answer below and ran in to error page . So i tried to check if the form fields from LP2 are actually posted to LP3 processing page containing AMPscript (as above) . but seems its not :

wonder , coz Because the fields on LP2 are inside a form: Probably RequestParameter('PAGEURL')

should point to LP3 and The form values will be available inside LP3 as post variables. So the LP3's requestparamenter will read the post variables and do the remaining create/update.

Also, i have the in LP2 urls as :

var @FullURLVariable 
SET @FullURLVariable = 'https://pages.exacttarget.com/page.aspx?QS=773ed3059447707de0a1f70d798402bfe159090ff62cebcc1fe03cb2fe058' 
SET @successpageurl = RedirectTo(TreatAsContent(@FullURLVariable))

…i also tried to change the urls to :

var @FullURLVariable 
SET @FullURLVariable = "https://pages.exacttarget.com/page.aspx?QS=773ed3059447707de0a1f70d798402bfe159090ff62c1dfebcc1fe03cb2fe058&e="+ varemail + "&m=" + mobile + "&country=" + country+ "&lastname=" + varlastname+ "&firstname=" + varfirstname+ "&zip=" + zip; 
SET @successpageurl = RedirectTo(TreatAsContent(@FullURLVariable))

…..fails seems the values are not being posted at LP3 at all…. any pointers..pls ..thx!!

processing page LP3: here i just wanted to first see, if the values are posted to this page by displaying them :

%%[ VAR @uemailaddress, @ufirstname, @ulastname, @umobile, @ucountry, @uzip, @ucustno

/* Get variables */

SET @uemailaddress = RequestParameter("varemail")
SET @ufirstname = RequestParameter("varfirstname")
SET @ulastname = RequestParameter("varlastname")
SET @umobile = RequestParameter("mobile")

IF NOT EMPTY(@custno) THEN
SET @ucustid = RequestParameter("custno")
ENDIF

IF EMPTY(@custno) THEN
SET @custno= 007007
ENDIF

SET @uzip = RequestParameter("zip")

SET @ucountry = ProperCase(RequestParameter('country'))
SET @time = Now()

]%%

%%=v(@ucustno)=%%
%%=v(@uemailaddress)=%%
%%=v(@ufirstname)=%%
%%=v(@ulastname)=%%
%%=v(@umobile)=%%
%%=v(@ucountry)=%%

Best Answer

Your processing page is a landing page consisting of only ampscript and needs to look something like this:

%%[

VAR @var1, @var2, @var3, @emailaddress, @result

/* Get variables */
SET @emailaddress = RequestParameter("emailaddress") 
SET @var1 = RequestParameter("var1") 

/* etc. */

/*Update/insert the records. See this for explanation of arguments http://help.exacttarget.com/en/documentation/exacttarget/content/ampscript/ampscript_syntax_guide/data_extension_ampscript_functions/#UpsertData   */

SET @result = UpsertData("DE_NAME", 1, "emailaddress", @emailaddress, "var1", @var1.... )

IF @result >= 1 THEN 
  Redirect("http://success.html")
ELSE
  Redirect("http://fail.html")
ENDIF

]%%
Related Topic