Hi,
I’m building a personality quiz, and I need to identify the profile based on the maximum score among 4 quiz scores.
The script below correctly retrieves the maximum score, but the part (IF statements) to display the related profile is not working effectively.
I would be very grateful if someone can please help me?
Many thanks,
Gilles
%%Profileone = sgapiGetValue(1);
%%Profiletwo=sgapiGetValue(2);
%%Profilethree=sgapiGetValue(3);
%%Profilefour=sgapiGetValue(4);
%%totalvalues=array(sgapiGetValue(1),sgapiGetValue(2),sgapiGetValue(3),sgapiGetValue(4));
%%maximumvalue=sgapiPrint_R(sgapiMax(%%totalvalues));
if (%%Profileone = %%maximumvalue)
{ %%output = “Profileone”; }
if (%%Profiletwo = %%maximumvalue)
{ %%output = “Profiletwo”; }
if (%%Profilethree = %%maximumvalue)
{ %%output = “Profilethree”; }
if (%%Profilefour = %%maximumvalue)
{ %%output = “Profilefour”; }
sgapiSetValue(5,%%output);
I’m sorry that I don’t have time to go over this in detail, but I will take a swag at it. Try replacing the ‘=’ in your IF statement with”==”. A single equal sign in PHP is used in calculations or to declare a variable; a double equal sign is used to compare two values to see if they are equal.