I make linked lists in opencart
view
<script> $(document). ready(function () { $("#country").change(function () { var countryval = parseInt( $("#country").val() ); //console.log(countryval); selectRegion(countryval); }) }) function selectRegion(countryval) { var region = $("#region"); if (countryval > 0){ $("#divregion").fadeIn("slow"); region.attr("disabled", false); region.load( "/catalog/controller/account/order.php", {countryval : countryval} ); } } </script> <form action="/catalog/controller/account/order.php" method="post"> <legend>Адрес доставки</legend> <!-- Text input--> <div class="form-group"> <label class="col-sm-2 control-label" for="textinput">Область</label> <div class="col-sm-10"> <select name="country" id="country"> <option value="0">- Выберите область -</option> <?php foreach ($regions as $region){ ?> <option value="<?php echo $region['id']?>"><?php echo $region['name']?></option> <?php } ?> </select> </div> </div> <div class="form-group"> <label class="col-sm-2 control-label" for="textinput">Город</label> <div class="col-sm-10" id="divregion"> <select disabled id="region" name="region" > <option value="">- Выберите город -</option> <?php foreach ($oll_city as $city){ ?> <option value="<?php echo $city['id']?>"> <?php echo $city['name']?></option> <?php } ?> </select> </div> </div> </form> controller
$sq = $this->request->post['countryval']; print_r($sq); Trying to get the values that came to the server, gives an error Notice: Undefined index: countryval
Tell me, maybe I have incorrectly specified the paths for data transfer.
How to do? transfer data immediately to the model and there to make a request to the database or to the controller.
model
public function getRegion(){ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "region"); return $query->rows; }