Ejemplo n.º 1
0
 public static function getInstance()
 {
     if (!self::$instance instanceof self) {
         self::$instance = new self();
     }
     return self::$instance;
 }
Ejemplo n.º 2
0
  <html>
    <body>
        <form id="form1" name="form1" action="" method="post" >
            <div>
                <label for="list">warehouses </label>
                <select name="list" onchange="this.form.submit()">
                    <option value=''>-----SELECT-----</option>
                    <?php 
//$con = \mysqli_connect('localhost', 'phpuser', 'phpuserpw','ics');
if (mysqli_connect_errno()) {
    echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
//$sql="SELECT * FROM `warehouses` WHERE 1";
//$result = mysqli_query($con,$sql);
$result = WarInvDB::getInstance()->find_warehouses();
if (!$result) {
    printf("failed query");
}
while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) {
    $selected = isset($_POST['list']) && $_POST['list'] === $row['id'] ? 'selected' : '';
    //echo "<option value={$row[id]}>{$row[wlocation]}</option>";
    echo "<option value=" . $row[id] . ">" . $row[wname] . ', ' . $row[wlocation] . "</option>";
    //echo "<option value='$row[id]' $selected >$row[location]</option>";
}
?>
                </select>
            </div>
            <div>
               
                <?php