Hi there, I am submitting some data using a seperate PHP script in following manner. Problem is that in my surveyResponses.php template there exist three text type editable regions viz. account, service_category, and sub_service_category. This fields values are stored into the database with html special characters. I tried to use some PHP functions with it still its getting inserted the same.
for example:
for example:
At&T is getting inserted as AT&T
- Code: Select all
<cms:php>
if(isset($_POST['submit'])){
global $CTX, $FUNCS;
$account = $FUNCS->cleanXSS($_POST['account']);
$category = $FUNCS->cleanXSS($_POST['service_category']);
$sub_service_category = $FUNCS->cleanXSS($_POST['sub_service_category']);
$email = $FUNCS->cleanXSS($_POST['email']);
$questionCount = $_POST['questioncount'];
$CTX->set( 'questioncount', $questionCount);
/* Send data from PHP to Couch */
$CTX->set( 'account', $account );
$CTX->set( 'service_category', $category);
$CTX->set( 'sub_service_category', $sub_service_category);
$CTX->set( 'email', $email);
}
</cms:php>
<cms:repeat count="<cms:show questioncount />" startcount='0'>
<cms:php>
global $CTX, $FUNCS;
$questionNo = question."<cms:show k_count />";
$answerNo = answer."<cms:show k_count />";
$question = $FUNCS->cleanXSS($_POST["$questionNo"]);
$answer = $FUNCS->cleanXSS($_POST["$answerNo"]);
$CTX->set('question',$question);
$CTX->set('answer',$answer);
$CTX->set('randomName',"<cms:random_name />");
</cms:php>
<cms:db_persist
_masterpage='surveyForm.php'
_mode='create'
_invalidate_cache='0'
_autotitle='0'
k_page_title=question
k_page_name=randomName
question=question
answer=answer
>
<cms:if k_error >
<font color='red'>ERROR:
<cms:each k_error >
<cms:show item /><br>
</cms:each>
</font>
<cms:else />
<cms:if k_count='0'>
<cms:set pageIds="<cms:show k_last_insert_id />" 'global' />
<cms:else/>
<cms:set pageIds="<cms:show pageIds /> , <cms:show k_last_insert_id />" 'global' />
</cms:if>
</cms:if>
</cms:db_persist>
</cms:repeat>
<cms:php>
global $CTX;
$CTX->set('randomName',"<cms:random_name />");
</cms:php>
<cms:db_persist
_masterpage='surveyResponses.php'
_mode='create'
_invalidate_cache='0'
_autotitle='0'
k_page_title=account
k_page_name=randomName
response_details=pageIds
account=account
service_category=service_category
sub_service_category=sub_service_category
email=email
/>