/var/www/hkosl.com/sinomax/survey/webadmin/survey_form_add.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php
    
require_once('check_login.php');

    
/*$message = "";

    if (empty($_POST["form_xml"]) || empty($_POST["form_html"])) {
        $message .= "Cannot get form data. Please try again.";
    }

    if (!empty($message)) {
        echo $message;
        exit;
    }*/

    
if (empty($_POST["form_xml"]) || empty($_POST["form_html"])) {
        exit;
    }

    
$result fn_parse_form_data($_POST["form_xml"]);

    
$sort 1;
    foreach (
$result as $question) {
        
$sql        "insert into question (campaign_id, `name`, `type`, `label`, sort, createdate, createby) values (?,?,?,?,?,?,?)";
        
$parameters = array((int)$_POST["campaign_id"], $question["name"], $question["type"], $question["label"], $sort$nowdate$_SESSION['cmsloginid']);
        
bind_pdo($sql$parameters);

        
$sort++;
    }

    
$sql        "update campaign set form_html=?, form_xml=? where id = ?";
    
$parameters = array($_POST["form_html"], $_POST["form_xml"], (int)$_POST["campaign_id"]);
    
bind_pdo($sql$parameters);

    echo 
"SUCCESS";

    
//header("Location:  campaign_index.php?msg=1");