I have a cloud page with a form. When a customer submits this form they are directed to the Thank you landing page. I have two versions of the Thank you landing page.

  1. customers who rate us greater than 8 and
  2. customers who rate us less than 9.

The cloud page has form data which I want to post onto the Thank you page to pass back to a DE from there.

my code in the landing page below (this doesn't work)

Question: Can a url be passed into a form action based on a condition? how would i do it?

set @nps = RequestParameter('nps') 

If @nps > "8" then

set @url = "www.yahoo.com"
set @url = "www.google.com"
        <form action="%%=v(@url)=%%" method="post">

1 Answer 1


Your code does indeed not look correct. It seems like you are mixing your form code with code from the page to which the form is submitted.

Since the nps is not known prior to form submission, you will need to adapt your content on landing page according to the nps, and not the action of the form. So it will look like this.

Form page:

<form action="https://www.example.com/thankyou" method="post">

Thank you page:

SET @nps = RequestParameter('nps') 
IF @nps > 8 THEN
Wow, you really like us! :-)    
I hope we can do it better next time    
  • NPS score is a url parameter that is passed from the email and being requested using requestparameter in the landing page. When the form is submitted and i want to direct them to either version 1 or version 2 of the thank you page depending on their score. Am i right in assuming that this isnt possible as i am mixing my html form code with ampscript? thanks
    – Rahul
    Sep 11, 2021 at 4:23

You must log in to answer this question.

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