Hi,
so, in the last hour, I've been trying to get a piece of code (I have no idea how PHP works btw) to work.
The idea is that at the start of every survey an equation question runs that randomises the background and text colour for everyone who takes the survey. The chances of red or blue are 40% each, and the chances for green should be 20%.
What I've ended up with is this:
Code:
$num = rand(0,99);
if($num > 0 && $num < 40) {
echo '<body style="background-color:red">';
}
elseif($num > 41 && $num < 80) {
echo '<body style="background-color:blue">';
}
else {
echo '<body style="background-color:green">';
}
Now, I don't know how blatantly obvious my horrible programming skills are, but in the end, this won't work. Instead of changing the background colour of the survey it changes the background colour of the text box when creating the equation question. It also deletes all code between two 's. So p.e. when I try to edit the question again, the background will be red (always) and "<body style="background-color:green">" and all the others will be gone.
I hope I managed to portrait my case enough for others to understand it...
If anyone has the slightest idea how to make my concept work, I'd be incredibly grateful if you would share your wisdom with me.
(I put the code into the Logic tab now so that it doesn't always delete the body style stuff)
Thanks up ahead,
MW