Search code examples
vbscriptasp-classic

Problem in response.write escaping quotes


Hey friends please help me ... how can i write response.write statement..... i want to put radio button but threre is some problem in response.write to get string from the record set RS and ORS...

set ORS = Server.CreateObject("ADODB.recordset")
getopt="SELECT * FROM Options WHERE QuestionID=" & RS("QuestionID")
ORS.Open getopt,Conn

if not ORS.EOF then
    ORS.movefirst
    do
        response.write " <input type='radio' name=' 'Question' & RS('QuestionID')& ''' value='Answer' & ORS('OptionID') & ''' > <h2 >" & ORS("Option") & "</h2><br />"
        ORS.movenext
    loop until ORS.EOF
end if

RS.movenext
loop until RS.EOF

Solution

  • Use double quotes " to delimit server side strings, and single quotes ' for the client side:

    response.write " <input type='radio' name='Question" & RS("QuestionID") & "' value='Answer" & ORS("OptionID") & "'> <h2>" & ORS("Option") & "</h2><br />"