Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <div class="form-group">
- <label for="fechaInicio">Fecha de la cita:</label>
- <div class="input-group date fecha">
- <input type="text" name="fechaInicio" class="form-control" id="fechaInicio" ng-model="cita.fechaInicio"><span class="input-group-addon"><i class="glyphicon glyphicon-th"></i></span>
- </div>
- $scope.getHoras = function(){
- var fechaInicio = fechaInicio;
- $http.get('../api/horas.php'),{'fechaInicio':fechaInicio}.then(function(response){
- $scope.citas = response.data;
- });
- };
- <?php
- $data = json_decode(file_get_contents("php://input"));
- @session_start();
- $id = $_SESSION["user_id"];
- $servername = "localhost";
- $username = "root";
- $password = "root";
- $dbname = "pruebas";
- $conn = new mysqli($servername, $username, $password, $dbname);
- /*$sql = "SELECT hora FROM horas where $fecha and horaCompleta = '1'"*/
- $sql = "SELECT hora FROM citas WHERE horaCompleta = 0 AND 'fechaInicio = $date-> fechaInicio' ";
- $result = $conn->query($sql);
- if ($result->num_rows > 0) {
- // output data of each row
- $data = array() ;
- while($row = $result->fetch_assoc()) {
- $data[] = $row;
- }
- } else {
- echo "0 results";
- }
- echo json_encode($data);
- $conn->close();
- ?>
- <div class="form-group">
- <label for="hora" ng-init="getHoras()">Hora:</label>
- <select ng-model="cita.hora">
- <option
- value="{{cita.hora}}"
- ng-repeat="cita in citas">
- {{cita.hora}}
- </option>
- </select>
- $scope.getHoras = function(){
- var fechaInicio = fechaInicio;
- $http.get('../api/horas.php'),{'fechaInicio':fechaInicio}.then(function(response){
- $scope.citas = response.data;
- });
- };
- $scope.getHoras = function(){
- var fechaInicio = $scope.fechaInicio;
- //o vm.fechaInicio, según tengas referenciada el view model
- $http.get('../api/horas.php'),{'fechaInicio':fechaInicio}.then(function(response){
- $scope.citas = response.data;
- });
- };
Add Comment
Please, Sign In to add comment