Free software to run questionnaire based experiments
It sounds like you're looking for a platform on which to implement computerized adaptive tests (since subsequent questions are contingent on prior responses).

I found Concerto, which is based in R and MySQL, but allows some flexibility in presentation (it says it uses HTML directly, but you could probably couple it with another language).