Example #1
0
function formElemCreate($name_id, $html_class = null, $input_area = null)
{
    require_once SERVER_ROOT . '/module/form_elem/dist/create_select.php';
    require_once SERVER_ROOT . '/module/form_elem/dist/create_input.php';
    require_once SERVER_ROOT . '/module/definition/module.php';
    $server = getenv('server');
    $userWR = getenv('userRO');
    $passWR = getenv('passRO');
    $db = getenv('db');
    $html = '';
    if ($name_id === 'category') {
        $html_class = 'category';
    } else {
        if ($html_class === null) {
            $html_class = "";
        }
    }
    // Create connection
    $conn = new mysqli($server, $userWR, $passWR, $db);
    // Check connection
    if ($conn->connect_error) {
        die("Connection failed: " . $conn->connect_error);
    }
    //<<< Get input info.
    $sql = "select html_type, title, tooltip \n" . "from param_input \n" . "where name_id = '" . $name_id . "' \n";
    $result = $conn->query($sql);
    $row = $result->fetch_assoc();
    $html_type = $row["html_type"];
    $title = $row["title"];
    $tooltip = $row["tooltip"];
    //>>>
    //<<< Handle different types of write inputs.
    if ($html_type === 'select') {
        //Generate dropdown html.
        $html = create_select($name_id, $title, $html_class, $tooltip, $input_area);
    } else {
        if ($html_type === 'input') {
            //Generate input html.
            $html = create_input($name_id, $title, $html_class, $tooltip, $input_area);
        }
    }
    //>>>
    $conn->close();
    return $html;
}
Example #2
0
    echo "<br />";
    echo "Address";
    create_input("add1", 20);
    echo "<br />";
    echo "Address";
    create_input("add2", 20);
    echo "<br />";
    echo "City";
    create_input("city", 10);
    echo "State";
    create_input("state", 2);
    echo "Zip";
    create_input("zip", 5);
    echo "<br />";
    echo "Email";
    create_input("email", 20);
    echo "<br />";
    ?>
<input type="submit" value="Register" />
</p></form>
<?php 
} else {
    echo "<p>Data Posted</p>";
    $fd = fopen($datadir . "/" . $_POST['ssn1'] . $_POST['ssn2'] . $_POST['ssn3'], "w");
    fwrite($fd, "Last Name:" . $_POST['lname'] . "\n");
    fwrite($fd, "First Name:" . $_POST['fname'] . "\n");
    fwrite($fd, "Address:" . $_POST['add1'] . "\n");
    fwrite($fd, "Address:" . $_POST['add2'] . "\n");
    fwrite($fd, "City:" . $_POST['city'] . "\n");
    fwrite($fd, "State:" . $_POST['state'] . "\n");
    fwrite($fd, "Zip:" . $_POST['zip'] . "\n");
Example #3
0
    $_SESSION["1_.{$questionId}._answer"] = $value[count($value) - 1];
    $cell2 = create_select(["name" => '1_' . $questionId, "contents" => $options]);
    echo create_table_row(["contents" => array(create_table_cell(["contents" => $cell1]), create_table_cell(["contents" => $cell2]))]);
    $questionId++;
}
$brTag = create_element("br", false, null);
$questionId = 0;
foreach ($categoryTwo as $key => $value) {
    $cell1 = $key;
    $options = array();
    for ($i = 0; $i < count($value) - 1; $i++) {
        array_push($options, create_input(["type" => "checkbox", "value" => $value[$i], "name" => '2_' . $questionId . '_checklist[]']) . $value[$i]);
    }
    $_SESSION["2_.{$questionId}._answer"] = $value[count($value) - 1];
    $content = implode($brTag, $options);
    echo create_table_row(["contents" => array(create_table_cell(["contents" => $cell1]), create_table_cell(["contents" => $content]))]);
    $questionId++;
}
$questionId = 0;
foreach ($categoryThree as $key => $value) {
    $cell1 = $key;
    $content = create_input(["type" => "text", "name" => '3_' . $questionId]);
    $_SESSION["3_.{$questionId}._answer"] = $value;
    echo create_table_row(["contents" => array(create_table_cell(["contents" => $cell1]), create_table_cell(["contents" => $content]))]);
    $questionId++;
}
echo create_table_row(["contents" => array(create_table_cell(["contents" => create_input(["type" => "submit", "name" => "submit", "value" => "Send", "id" => "submit"])]))]);
end_table();
end_form();
end_body();
end_html();
Example #4
0
//--會員分類
$member_typelist = $conn->GetArray('select * from ' . PREFIX . "data_list where type='memberdesh' and status=1");
if ($member_typelist) {
    foreach ($member_typelist as $k => $v) {
        $array_typem[$v['new_type']] = $v['name'];
    }
}
$type_output = str_replace('"', "'", json_encode(array('type' => $array_typem)));
$sex_output = str_replace('"', "'", json_encode(array('sex' => array('0' => '女', '1' => '男'))));
//--匯出資料
$data["output_title"] = array('編號', '帳戶', '姓名', '帳戶類型', '性別', 'email', '身分證字號', '生日', '電話', '地址');
$data["output_row"] = array('id', 'account', 'name', $type_output, $sex_output, 'email', 'id_num', 'birthday', 'phone', 'address');
$data["cpos"] = $cpos;
//---------
if ($id || $id == '0') {
    $data["one"]["sex_html"] = create_input("sex", $_SETUP["sex"], $type = "radio", $data["one"]["sex"]);
    $data["one"]["type_html"] = Make_radio($array_typem, $data["one"]["type"], 'type');
} else {
    $member_typelist = $conn->GetArray('select * from ' . PREFIX . "data_list where type='memberdesh' and status=1");
    if ($member_typelist) {
        foreach ($member_typelist as $k => $v) {
            $array_typem[$v['new_type']] = $v['name'];
        }
    }
    foreach ($data["list"] as $k => $v) {
        $data["list"][$k]["mode_html"] = $array_typem[$v["type"]];
        $data["list"][$k]["sex_html"] = $_SETUP["sex"][$v["sex"]];
    }
}
$_SESSION["admin_info"]["search"]["status"] = '<option value="">選擇狀態</option>' . Make_list($_SETUP["status"], $_GET["s_status"]);
include_once "index.php";