I have currently build a microsite page that, when accessed by a Subscriber by clicking a link in an email, automatically loads data from a data extension relating to that subscriber.

This is done using the _SubscriberKey standard field.

I am trying to build a similar page, where the subscriber key is entered manually, and so can be used by our service agents, but I can't figure out how to let them enter a key that is then passed to the next page as a variable.

Does anyone know how to pass a variable from one page to another?


1 Answer 1


You'll need to do a form post and then retrieve the value from the input box.

There are some details on how to do that in my preference center boilerplate example:

<script type="text/javascript" runat="server">

    Platform.Load("core", "1.1.1");

    var debug = false;
    var request = {};
    SetVar("urlThis", Platform.Request.RequestURL);

    if (Request.Method == "GET") {

        if (debug) {

        // retrieve values from the subscriber context or URL parameters using Attribute.GetValue("VARNAME") or Request.GetQueryStringParameter("VARNAME");

        // in your email, use the AMPScript MicrositeURL() function with the landing page page id to ensure the subscriber context is passed to your landing page

        // set AMPScript variables using the SetVar function below

    } else if (Request.Method == "POST") {

        if (debug) {

        // retrieve POST values using Request.GetFormField("VARNAME")

        // do the appropriate API call

        // redirect to the RESULTURL based on success or failure of API call


    function SetVar(varName, varValue){
        request[varName] = varValue;
        Variable.SetValue(varName, varValue);

    function isEmpty(str) {
      return (!str || 0 === str.length);
    if (debug) {
        Write("<br><br>debug output: " + Stringify(request));

</script><!DOCTYPE HTML>
      <form id="formName" action="%%=v(@urlThis)=%%" method="post" enctype="application/x-www-form-urlencoded">
        default form values with %%=v(@VARNAME)=%% or <ctrl:eval>VARNAME</ctrl:eval>

There's also a simple AMPScript example in Macca's answer on another post:

%%[ IF @@ExecCtx == "LOAD" THEN]%%
    <form action="%%=RequestParameter('PAGEURL')=%%"> method="post">
        Name: <input type="text" name="name"><br>
        Email: <input type="text" name="email"><br>
        <input type="submit">
%%[ ELSEIF @@ExecCtx == "POST" THEN]%%
    %%[/*Handle post here*/]%%
  • 1
    Thank you, that worked perfectly, I now have a functioning search and update microsite!
    – Gareth
    Commented Sep 27, 2017 at 9:37

You must log in to answer this question.

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