How do I pass MML Variables from one page to the next

  1. Home
  2. Knowledge Base
  3. GMS
  4. How do I pass MML Variables from one page to the next

Answer

There are several methods of passing variables from one page to the next.

  • Using the URL: Simply add details to the end of the URL. For example, the URL might become:

    http://mail.domain.com/function.mml?
    domain=domain.com&user=user55
    

    (note this should all be on one line).
    In this case, when the MML page function.mml is executed, there will be two variables available, domain and user.

    The disadvantage is that users can see, write down and copy the values of the variables. This means that you will need to check that the variables contain valid contents every time you use them. Since the values are displayed openly, it would be risky to do this with passwords.

  • Using an HTML form
    Hidden variables may be used in HTML forms to send additional information (as well as new information entered by the user). To create a hidden variable, add a lines like this to your HTML form:

    <input type="hidden"
    name="domain"
    value="domain.com">
    <input type="hidden"
    name="user"
    value="user55">
    

    When the MML page is executed, there will be two variables available – domain and user.

    It will take a more experienced user to “spoof” the contents of the hidden variables, but it can still be done.

  • Using GLOBAL variables
    Global variables are maintained by the web server and mean that no information is passed between the web browser and the server. Global variables are maintained for the maximum session limit defined in GMS (default is 20 minutes). To use a Global variable, you need to tell the MML interpreter that a variable is global, and then you can use it in all subsequent pages. To create a global variable use a line like:

    global domain;
    
    (later in code)
    
    domain = "domain.com";
    

    In the subsequent MML pages, you can now use the variable “domain”. NOTE: if the session is destroyed (the user has done nothing for 20 minutes), then when you attempt to use the value “domain” it will be automatically created and be empty.

Keywords:MML, variables, pass, passing

Was this article helpful?

Related Articles