JimboZA had it right way back in the first reply.

Take logs of both sides, take the exponent to the front, solve for exponent

See "rule 4" here: http://www.mathwords.com/l/logarithm_rules.htm

5 ^ X = 18

log(5^x) = log(18)

x * log(5) = log(18)

x = log(18)/log(5)

Or you can think:

5^x = 18

log

_{base5}(5^x) = log

_{base5}18

x = log

_{base5}18

and then use the "change of base" forumla (rule 5 at the above page.)