====== caseToken() ======

''string **caseToken**()''

Each questionnaire has an internal ID (token), which enables it to be identified during the course of the survey. The ID also appears after "Next" has been clicked on for the first time in the browser's address bar (e.g.  %%https://www.soscisurvey.de/demo/?t=%%__12345abcde__).

Using this ID, it is possible to leave the current questionnaire to do something else (e.g. surf another website, and then subsequently comes back and resume the questionnaire. The prerequisite is that the external website saves the internal ID, and submits ''t'' as the GET variable in the URL back to the questionnaire ([[:en:survey:url|URL to the questionnaire]]).

**Note:** The external website has to actively accept the token, save it, and add to it to the URL back to the questionnaire. As a rule, this is only possible if the external website uses a server-side scripting language (e.g. PHP or AS). Saving and returning the ID has to then be separately implemented on the external website.

**Note:** The questionnaire ID is not visible in the data record. If you collect data on the external website and assign this to the questionnaire, you also have to transfer the case number (''[[:en:create:functions:casenumber|caseNumber()]]''). 

**Tip:** The questionnaire ID is also available in the [[:en:create:placeholders#predefined_placeholders|predefined placeholder]] %caseToken% (see example).


===== Example =====

In the following example, the questionnaire ID (token) and case number are submitted to an external website ''%%www.s2survey.net%%'', which the participant will be sent to by using ''[[:en:create:functions:redirect|redirect()]]''. 


<code php>
redirect('https://www.s2survey.net/?tk='.caseToken().'&num='.caseNumber(), true);
</code>

Instead of using functions, the corresponding placeholder could also just be used in the command ''redirect()''.

<code php>
redirect('https://www.s2survey.net/?tk=%caseToken%&num=%caseNumber%', true);
</code>