<?php

require("includes/check_auth_user.php");
require("includes/dbconnect.php");
include('includes/function.php');

$admin = $_SESSION["admin_" . $dbname];
$zdb = $_SESSION["zdbyear_" . $dbname];

if ($_REQUEST["ctr"]) {
    $ctr = $_REQUEST["ctr"];
    $hide = $_REQUEST["hide"];
    $hide_var = "";

    if ($hide == 0) {
        $hide_var = 'style="display:none;"';
    }

    echo "<tr>";
    echo "<td><i class='fa fa-close remove' $hide_var ></i></td>";
    echo "<td>";
    echo "<select class='form-control form origin select2 fetchpart_$ctr' name='origin[]' style='width:100%'>";
    echo "<option value=''></option>";
    $getordn = mysqli_query($conn, "SELECT `name` FROM $zdb.`origin` order by name ") or die(mysqli_error($conn));
    while ($ftordn = mysqli_fetch_array($getordn)) {
        echo "<option value='$ftordn[name]'>$ftordn[name]</option>";
    }
    echo "</select>";
    echo "</td>";
    echo "</tr>";

    $ctr++;
} else {
    echo "ERROR";
}
?>