Hi, I was wondering if I can get some help with changing client side javascript to server side javascript. I have a survey connected to an Enterprise Manager SQL database. My code works and the database is updated successfully but I get a warning message
"This Website uses a data provider that may be unsafe. If you trust the website click OK otherwise click cancel."
This warning happens twice which I understand one is to open the database and one is to insert data into it.
I do know serverside begins with
<%@ LANGUAGE = JavaScript%>
But I'm not sure how to take this code and adapt it to serverside javascript, and also where to place it within the asp file.
I've taken snippets of my code and placed it below.
Any help would be appreciated.
Kind regards
"This Website uses a data provider that may be unsafe. If you trust the website click OK otherwise click cancel."
This warning happens twice which I understand one is to open the database and one is to insert data into it.
I do know serverside begins with
<%@ LANGUAGE = JavaScript%>
But I'm not sure how to take this code and adapt it to serverside javascript, and also where to place it within the asp file.
I've taken snippets of my code and placed it below.
Any help would be appreciated.
Kind regards
Code:
// Find latest ID or default to 1 for first time
if (rs.eof)
{
var new_id = 1;
}
else
{
var new_id = rs(0) + 1;
}
// Find Selected anser for Q1
for (var i=0; i < document.survey.q1.length; i++)
{
if (document.survey.q1[i].checked)
{
var q1_ans = document.survey.q1[i].value;
}
}
var email_ans = document.survey.email.value.replace("'","''");
var feedback_ans = document.survey.feedback.value.replace("'","''");
var strInsertSQL = "INSERT INTO SURVEY_RESULTS_TAB VALUES (" + new_id + ",'" + email_ans + "','" +
q1_ans + "','" + q2_ans + "','" + q3_ans + "','" + q4_ans + "','" + q5_ans + "','" +
q6_ans + "','" + q7_ans + "','" + q8_ans + "','" + q9_ans + "','" + feedback_ans + "')";
adoConnection.Execute(strInsertSQL);
rs.close();
adoConnection.Close();
document.body.style.cursor = "default";
location.href = "thankyou.html";
}
//-->
</SCRIPT>
Code:
<form name=survey method=post onSubmit=survey_answers()> <input name="q1" type="radio" value="VS"> <input name="q1" type="radio" value="S"> <input name="q1" type="radio" value="D"> <input name="q1" type="radio" value="VD"> <input name="q1" type="radio" value="NA" checked> <INPUT type=button value="Submit" onClick="survey_answers()"> </form>
Comment