$sql = "SELECT `b`.`breed_wk`, `b`.`pet_type_wk`, CONCAT(`p`.`name`,' - ',`b`.`name`) AS `name`, "; $sql .= "`b`.`create_dt` FROM `breed` AS `b` INNER JOIN `pet_type` AS `p` ON `p`.`pet_type_wk` = `b`.`pet_type_wk` "; $sql .= "WHERE `b`.`breed_wk` > 0 ORDER BY `p`.`name` ASC, `b`.`name` ASC"; $to_display = Breed::find_by_sql($sql); //loop through all items foreach ($to_display as $value) { echo "<option value=\"" . $value->breed_wk . "\""; echo ">" . $value->name . "</option>"; } ?> </select></div> Color: <br><div class="form-group"><select name="color" class="form-control"> <option value="0">Undefined</option> <?php //we need to display all available records $to_display = Color::find_all(); //loop through all items foreach ($to_display as $value) { echo "<option value=\"" . $value->color_wk . "\""; echo ">" . $value->name . "</option>"; } ?> </select></div> Status: <br><div class="form-group"><select name="status" class="form-control"> <option value="0" >Undefined</option> <?php //we need to display all available records $to_display = Status::find_all(); //loop through all items foreach ($to_display as $value) { echo "<option value=\"" . $value->status_wk . "\"";
} } } // redirect for colors(s) were updated but no new color added redirect_head(ROOT_URL . "admin/manage_colors.php"); } //header template require_once "../requires/template/header.php"; ?> <section id="registration" class="container"><form class="center" role="form" action="<?php echo file_name_with_get(); ?> " method="post" ><fieldset class="registration-form"> <?php $colors_array = Color::find_all(); $count = count($colors_array); for ($i = 0; $i < $count; $i++) { echo "<div class=\"form-group\"><input type=\"text\" class=\"form-control\" name=\"" . $i . "\" value=\"" . $colors_array[$i]->name . "\">"; echo "<a href=\"manage_colors.php?delete_color_wk=" . $colors_array[$i]->color_wk . "\">Delete</a> </div>"; } ?> <br> Add new color:<input type="text" name="new_color" class="form-control" value=""><br /> <div class="form-group"><button type="submit" value="submit" name="submit" class="btn btn-success btn-md btn-block">Submit</button></div> </fieldset></form></section> <?php //this is a special instance, remove the message, if it's set since we set the messages in this form $session->unset_variable('message');