I've developed a landing page with two submit buttons, CTA1 and CTA2. When a user clicks on CTA1, data should be updated/inserted into DE1. Similarly, clicking on CTA2 should update/insert data into DE1, but with a different row for each button. Both rows should have the same user, but with different CTA_Button values. I've set up two primary keys, II and CTA_Button. However, after the first submission, users encounter a '500 Internal server error' when attempting to resubmit the button value. Could you please assist with this issue?
%%[ var @subscriberKey, @value, @email SET @subscriberKey = _subscriberkey IF RequestParameter("submitted") == "true" THEN /* Retrieve form data */ SET @value = RequestParameter("value") SET @identity_identifier = @subscriberKey /* Get Subscriber Key */ SET @email = emailaddr /* Get Subscriber Email */ SET @createdDate = Now() /* Get current date and time */ /* Lookup to check if the user exists in the Data Extension */ SET @lookupRows = LookupRows('AT_Unsubcribe_Data', 'identity_identifier', @identity_identifier, 'CTA_Button', @value) SET @rowCount = RowCount(@lookupRows) IF @rowCount > 0 THEN /* User exists Update existing row with CTA1 value */ Upsertdata('AT_Unsubcribe_Data', 1, 'identity_identifier', @identity_identifier, 'Email_Address', emailaddr, 'CTA_Button', @value, 'CreatedDate', @createdDate) ELSE /* User doesn't exist, insert a new row */ InsertData('AT_Unsubcribe_Data', 'identity_identifier', @identity_identifier, 'Email_Address', emailaddr, 'CTA_Button', @value, 'CreatedDate', @createdDate) ENDIF ]%%<meta http-equiv="refresh" content="0;url=https://at.iqos.com/de/"> %%[ ENDIF ]%%%%[ IF RequestParameter("unsub") == "true" THEN /* Retrieve form data */ SET @value = RequestParameter("value") SET @identity_identifier = @subscriberKey /* Get Subscriber Key */ SET @email = emailaddr /* Get Subscriber Email */ SET @createdDate = Now() /* Get current date and time */ /* Lookup to check if the user exists in the Data Extension */ SET @lookupRows = LookupRows('AT_Unsubcribe_Data', 'identity_identifier', @identity_identifier, 'CTA_Button', @value) SET @rowCount = RowCount(@lookupRows) IF @rowCount > 0 THEN /* User exists Update existing row with CTA1 value */ Upsertdata('AT_Unsubcribe_Data', 1, 'identity_identifier', @identity_identifier, 'Email_Address', emailaddr, 'CTA_Button', @value, 'CreatedDate', @createdDate) ELSE /* User doesn't exist, insert a new row */ InsertData('AT_Unsubcribe_Data', 'identity_identifier', @identity_identifier, 'Email_Address', emailaddr, 'CTA_Button', @value, 'CreatedDate', @createdDate) ENDIF ////UNSUB CODE//// ENDIF]%%<!-- CTA Button 1 --><div class="container"><div align="center"><form method="post"><input type="hidden" name="submitted" value="true"><input type="hidden" name="value" value="Weiterhin_E_Mails_erhalten"><button type="submit" class="submit_btn btn " style="background-color:#34303D;border:1px solid #34303D;border-radius:45px;color:#ffffff;display:inline-block;font-family: ‘IQOS’, Noto Sans, sans-serif; font-weight:normal;line-height:30px;text-align:center;text-decoration:none;width:280px;-webkit-text-size-adjust:none;mso-hide:all;font-size:16px; padding: 10px 10px 10px 10px; cursor: pointer;">Weiterhin E-Mails erhalten:CTA1</button></form></div></div><div class="container"> <div style="padding-top: 30px;"></div><div align="center"><form method="post"><input type="hidden" name="unsub" value="true"><input type="hidden" name="value" value="Jetzt_abmelden"><button type="submit" class="submit_btn btn " style="background-color:#ffffff;border:1px solid #34303D;border-radius:45px;color:#34303D;display:inline-block;font-family: ‘IQOS’, Noto Sans, sans-serif; font-weight:normal;line-height:30px;text-align:center;text-decoration:none;width:280px;-webkit-text-size-adjust:none;mso-hide:all;font-size:16px; padding: 10px 10px 10px 10px; cursor: pointer;">Jetzt abmelden:CTA2</button></form> </div> </div>