String solutions with nonconstant scalar fields