<?php $d = new Debits(); if (isset($_POST['btn_plati'])) { $debit_id = Debits::get($_POST['btn_plati']); $d->debit_id = $_POST['btn_plati']; $d->method_pay = $_POST['method_pay']; $d->debit_status = "0"; $d->save(); echo "<div class='alert alert-success'>\n <i><strong>Uspesno!</strong> Naplatili ste dugovanje!</i> <a href='home.php?page=6'>Vratite se na dugovanja</a>\n </div>"; } else { echo "<div class='alert alert-danger'>\n <i><strong>Greska! </strong> Dosolo je do neocekivane greske</i> <a href='home.php?page=6'>Pokusajte ponovo</a>\n </div>"; } //print_r($debit_id); //header("location: home.php?page=6");
<?php $date = new DateTime(date("l")); /**************************************************************************/ $debit = new Debits(); if (isset($_POST['btn_submit'])) { //$debit->debit_id = ""; $who = $debit->who = $_POST['user_id']; $how_much = $debit->how_much = $_POST['how_much']; $for_mounth = $debit->for_mounth = $_POST['month']; if ($who != -1 && $how_much != -1 && $for_mounth != -1) { $debit->debit_status = "1"; $debit->insert(); echo "<div class='alert alert-success'>\n <i><strong>Uspesno!</strong> Ubacili ste dugovanje.</i>\n </div>"; } else { echo "<div class='alert alert-danger'>\n <i><strong>Greska!</strong> Popunite sva polja.</i>\n </div>"; } //print_r($_POST); } /***************************************************************************/ ?> <div class="form-group"> <h2 class="naslov"> Unesite podatke o dugovanju.</h2> <br> <form action="" method="POST"> <i class="fa fa-user"></i> <label for="user_id">Izaberite korisnika </label> <select class="form-control" name="user_id" id="user_id"> <option value="-1">Izaberite korisnika:</option> <?php /************************************************************************/ $all_users = Users::getAll();