Allright then, you can use a regular expression to check for this. This code is kind of confusing, but I'll explain it below.
if(ereg("[.+]",$q3)
{
// Get previous answers from DB ($q1 contains answer to Question 1)
$q1 = "cat";
$q3 = "What color is your [q1]?";
$q3 = ereg_replace("[(.+)]","\$\1",$q3);
eval("\$q3 = \"$q3\";");
}
First, you need to put the previous answers into an associative array so you can get their values easily. Then, the ereg_replace does most of the dirty work. It finds the brackets, and puts whatever is inside them into the \1 variable. It then replaces the brackets with the literal "$q1".
Now, $q3 is "What color is your $q1?". Then, you need to evaluate the new string to insert the value of $q1. After this code, $q3 contains "What color is your cat?".
Let me know if this is more along the lines of what you are trying to do...