0 votes
in SoSci Survey (English) by s139455 (190 points)
edited by SoSci Survey

Hi,

After a user completes a survey, on the last page, I want to display a link with caseNumber() as a parameter. Imagine something like this:

<a href="www.example.com?id=caseNumber()">Go to example.com</a>

However, it seems that PHP variables and placeholders cannot be used on the last page. As a workaround, I have created two other pages before the last page:

  • Page 1: A page where I replicate the contents of the last page by displaying a thank you message and a "Go to example.com" link. The link actually points to Page 2 described below instead of example.com.
  • Page 2: A page which redirects the user to example.com with caseNumber as a parameter. It includes the following PHP code only:

    redirect('www.example.com?id=%caseNumber%');

This seems to be working OK since the survey is finalised and the user gets redirected to example.com with his/her caseNumber passed as a parameter. However, it seems a bit hacky to me, so I was wondering if there's a better way to achieve the same functionality.

In case it helps, caseNumber is needed on example.com so that users can compare their answers with survey averages (via data visualisations). The survey data are retrieved in real time using SoSci's API.

Many thanks

1 Answer

0 votes
by SoSci Survey (302k points)

However, it seems that PHP variables and placeholders cannot be used on the last page.

Please use the placeholder instead of a function name. The following HTML code should work on the last page:

<a href="www.example.com?id=%caseNumber%">Go to example.com</a>

As a workaround, I have created two other pages before the last page

Also possible. But why not using a single page with the HTML content inclusing the placeholder? Plus the following PHP code to show no "next" button.

buttonHide();
by s139455 (190 points)
Indeed, the placeholder works on the last page! I had tried with caseNumber() and it didn't work, not sure why I didn't try with the placeholder as well...

>> But why not using a single page with the HTML content inclusing the placeholder?
I needed the redirect() function on the second page to finalise the survey, otherwise it wouldn't be finalised. (and I couldn't put redirect() on the same page with the contents since the contents would not be displayed)

In any case, many thanks for your help.
by SoSci Survey (302k points)
> I needed the redirect() function on the second page to finalise the survey

In general, there usually is no need to finalize the interview. But, of course, you can use the redirect() workaround as well :)

Willkommen im Online-Support von SoSci Survey.

Hier bekommen Sie schnelle und fundierte Antworten von anderen Projektleitern und direkt von SoSci Survey.

→ Eine Frage stellen


Welcome to the SoSci Survey online support.

Simply ask a question to quickly get answers from other professionals, and directly from SoSci Survey.

→ Ask a Question

...