Configurable list widget to sql database

  • Profile Image
    Asked on January 06, 2016 at 04:35 PM

    Hi, I have managed to work out how to get the form submissions to sql using php. The configurable list widget, predictably, appears in one field. As it seems to be a sub-table within the form is it possible to split it into separate fields in the database using php?

    Thank you.

    This is the php I am using, 'sightings' is the configurable list widget:

    // This function will run within each post array including multi-dimensional arrays
    function ExtendedAddslash(&$params)
            foreach ($params as &$var) {
                // check if $var is an array. If yes, it will start another ExtendedAddslash() function to loop to each key inside.
                is_array($var) ? ExtendedAddslash($var) : $var=addslashes($var);

    // Initialize ExtendedAddslash() function for every $_POST variable
    $submission_id = $_POST['submission_id'];
    $formID = $_POST['formID'];
    $ip = $_POST['ip'];
    $name = $_POST['fullname'][0] ." ". $_POST['fullname'][1];
    $email = $_POST['email'];
    $date = $_POST['date5'][0] ."-". $_POST['date5'][1] ."-". $_POST['date5'][2];
    $location = $_POST['location'];
    $sightings = $_POST['sightings'];
    $clickto = $_POST['clickto'];

    $db_host  = "";
        $db_name   = "db606819711";
        $db_username  = "dbo606819711";
        $db_password   = "*************";

        mysql_connect( $db_host, $db_username, $db_password) or die(mysql_error());

    // search submission ID

    $query = "SELECT * FROM `sightings` WHERE `submission_id` = '$submission_id'";
    $sqlsearch = mysql_query($query);
    $resultcount = mysql_numrows($sqlsearch);

    if ($resultcount > 0) {
        mysql_query("UPDATE `sightings` SET
                                    `fullname` = '$name',
                                    `email` = '$email',
                                    `date5` = '$date',
                                    `location` = '$location',
                    `sightings` = '$sightings',
                    `clickto` = '$clickto'    
                                 WHERE `submission_id` = '$submission_id'")
         or die(mysql_error());
    } else {

        mysql_query("INSERT INTO `sightings` (submission_id, formID, IP,
                                                                              fullname, email, date5, location, sightings, clickto)
                                   VALUES ('$submission_id', '$formID', '$ip',
                                                     '$name', '$email', '$date', '$location', '$sightings', '$clickto') ")
        or die(mysql_error());


  • Profile Image
    Answered on January 06, 2016 at 11:26 PM

    Config List Widget contains multiple fields so you will get a json array data out of it.


    So to get the value, it's either you will decode this data into php using json_decode and then use foreach function to get its value. You might find this helpful

    If you need further assistance, do let us know.