Example #1
0
</form>

<?php 
//print_r ($_REQUEST);
if ($_REQUEST['NEW_FIELD'] == 'YES') {
    $NEW_FIELD = 'YES';
} else {
    $NEW_FIELD = 'NO';
}
//$NEW_FIELD = 'YES';
$save = $_REQUEST['save'];
if ($save != '') {
    echo "Saving...";
    $error = validate_field_form();
    if ($error == '') {
        $id = save_field($error, $NEW_FIELD);
        format_field_translation_table(1);
        echo "OK!";
        $NEW_FIELD = "NO";
        $_REQUEST['field_id'] = $id;
    } else {
        echo "<font color='#ff0000'><b>ERROR!</b></font><br>" . $error . '';
    }
}
if ($_REQUEST['delete'] != '') {
    echo "Deleting...";
    $sql = "SELECT * FROM form_fields WHERE form_id=1 and field_id='" . $_REQUEST['field_id'] . "'";
    $result = mysql_query($sql);
    $row = mysql_fetch_array($result) or die(mysql_error());
    if (is_reserved_template_tag($row['template_tag'])) {
        echo "<p><font color='red'><b>Cannot Delete:</b>  This field contains a reserved 'Template Tag' and is needed by the system. Click on the 'R' icon next to the field for more information. Instead of deleting, please rename this field / change the type / move up or down. </font></p> ";
Example #2
0
if ($_SERVER["REQUEST_METHOD"] == "POST") {
    $form_string = null;
    $form_error = array();
    if (!isset($_POST['field_type'])) {
        $form_error['nofields'] = "Form needs atleast one form field to be generated.";
    } else {
        $form_id = null;
        if (isset($_SESSION['user_email'])) {
            $form_id = create_form($_POST['form_name'], date("Y-m-d H:i:s"), $_SESSION['user_email'], $connection);
        }
        $form_string = "<h2>{$_POST['form_name']}</h2><form>";
        $form_string .= "<table>";
        for ($i = 0; $i < count($_POST['field_type']); $i++) {
            $form_string .= get_form_string($i);
            if ($form_id) {
                save_field($form_id, $_SESSION['user_email'], $_POST['field_type'][$i], $_POST['field_title'][$i], $_POST['field_name'][$i], $i + 1, $_POST['field_options'][$i], $connection);
            }
        }
        $form_string .= "</table>";
        $form_string .= "</form>";
        $_SESSION['form_title'] = $_POST['form_name'];
        $_SESSION['form_string'] = $form_string;
    }
}
?>

<?php 
require 'template/header.php';
require 'template/navigation.php';
?>
<script>
Example #3
0
     }
     display_add_form($field);
     break;
 case 'edit':
     foreach ($ff as $f) {
         if ($f['name'] == $vars['name']) {
             $old_field = $f;
         }
     }
     $new_field = $old_field = get_field_from_saved($old_field);
     if ($vars['save']) {
         check_demo();
         $new_field = get_field_from_form($vars);
         if ($err = validate_edit_form($new_field, $old_field)) {
             $t->assign('error', $err);
         } elseif ($err = save_field($new_field, $old_field)) {
             $t->assign('error', $err);
         } else {
             admin_log("Additonal Field ({$new_field['name']}) changed");
             admin_html_redirect("fields.php", "Field info saved", "Field info saved to config");
             break;
         }
     }
     display_edit_form($new_field);
     break;
 case 'delete':
     check_demo();
     foreach ($ff as $f) {
         if ($f['name'] == $vars['name']) {
             $old_field = $f;
         }