i have created a simple html survey form under cloudpages which constains several questions with radio buttons and some with text boxes for answers. I want to know how to get radio button's values selected by user along with text in textboxes to a data extension.
Is it something which can be done through SSJS or AMpscript? I was trying to use this script in html form
<script runat ="server" language = "javascript">
platform.Load("core", "1")
var requestDE = DataExtnsion.Init("EED34E60-1B36-41E7-B7F8-21428023921C");
requestDE.Rows.Add({
some code
});
</script>
This is the page for Survey
I would also like to know how to capture the email address of subscriber who filled the survey as I haven't included any email address field in this form.
Updated ampscript
<html>
<head>
<style type="text/css">
body {
margin: 50px;
color: #555;
font-family: "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", Verdana, sans-serif;
}
</style>
%%[
var @q5_overallHow5, @q6_didOur6, @q8_wouldYou8, @q10_whatAspect10, @q11_whatAspect, @q12_pleaseExplain, @q15_additionalComments15
set @q5_overallHow5 = RequestParameter('q5_overallHow5')
set @q6_didOur6 = RequestParameter('q6_didOur6')
set @q8_wouldYou8 = RequestParameter('q8_wouldYou8')
set @q10_whatAspect10 = RequestParameter('q10_whatAspect10')
set @q11_whatAspect = RequestParameter('q11_whatAspect')
set @q12_pleaseExplain = RequestParameter('q12_pleaseExplain')
set @q15_additionalComments15 = RequestParameter('q15_additionalComments15')
InsertData("SurveyResults",
"q5_overallHow5",@q5_overallHow5,
"q6_didOur6",@q6_didOur6,
"q8_wouldYou8", @q8_wouldYou8,
"q10_whatAspect10", @q10_whatAspect10,
"q11_whatAspect", @q11_whatAspect,
"q12_pleaseExplain" @q12_pleaseExplain,
"q15_additionalComments15", @q15_additionalComments15
)
]%%
</head>
<body>
<h2>Thank you</h2>
<p>Thank you for completing the survey.</p>
</body>
</html>