substituted variable assignment

I try to run this script, however, it gives an exception in line 3. How do I do an assignment to a substituted variable?

#!/bin/bash
name=fruit
ext_$(eval echo ${name})=apple
tmp=ext_$(eval echo ${name})
if [[ ${!tmp} == *apple* ]]; then
 echo "apple"
 elif [[ ${!tmp} == *orange* ]]; then
 echo "orange"
fi

echo ${!tmp}

[COLOR="Blue"]Error Message:

line 3: ext_fruit=apple: command not found

I think closer would be:

eval ext_${name}=apple

Thanks. It worked.