• 23-11-2021, 01:11:54
    #1
    Çok saçma bir şeyden sebep göndermediğine eminim ama bulamadım, sizce bu form neden insert etmiyor olabilir

    <form action="settings/edit-process.php" method="POST" >
    <input type="hidden" name="reservation_agent" value="<?php echo $finduser['name'] ?><?php echo $finduser['surname'] ?>">

    <!--begin::Card body-->
    <div class="card-body border-top p-9">
    <div class="card-title m-0">
    <h3 class="fw-bolder m-0">Reservation Informations</h3>
    </div>
    <!--begin::Input group-->
    <div class="row">
    <div class="mb-10 fv-row col-md-6">
    <label class="form-label mb-3 required">Date</label>
    <input class="form-control form-control-solid" name="date" required placeholder="Pick date rage"/>
    </div>
    <div class="mb-10 fv-row col-md-6">
    <!--begin::Label-->
    <label class="form-label mb-3 required">Reservation Name</label>
    <!--end::Label-->
    <!--begin::Input-->
    <input type="text" class="form-control form-control-lg form-control-solid" name="fullname" placeholder="" value="" required/>
    <!--end::Input-->
    </div>
    </div>
    <!--end::Input group-->
    <div class="row">
    <div class="mb-10 fv-row col-md-6">
    <!--begin::Label-->
    <label class="form-label mb-3 required">Phone Number</label>
    <!--end::Label-->
    <!--begin::Input-->
    <input type="phone" class="form-control form-control-lg form-control-solid" name="phone" placeholder="" value="" required/>
    <!--end::Input-->
    </div>
    <div class="mb-10 fv-row col-md-6">
    <!--begin::Label-->
    <label class="form-label mb-3">E-mail</label>
    <!--end::Label-->
    <!--begin::Input-->
    <input type="email" class="form-control form-control-lg form-control-solid" name="mail" placeholder="" value="" />
    <!--end::Input-->
    </div>
    </div>
    <div class="card-title m-0">
    <h3 class="fw-bolder m-0">Reservation Details</h3>
    </div>
    <!--end::Input group-->
    <div class="row">
    <div class="fv-row mb-10 col-md-4">
    <!--begin::Label-->
    <label class="form-label">Room Number</label>
    <!--end::Label-->
    <!--begin::Input-->
    <input type="number" class="form-control form-control-lg form-control-solid" name="room" placeholder="" value="" required/>
    <!--end::Input-->
    </div>
    <div class="fv-row mb-10 col-md-4">
    <!--begin::Label-->
    <label class="form-label required">PAX</label>
    <!--end::Label-->
    <!--begin::Input-->
    <select name="pax" class="form-select form-select-lg form-select-solid" data-control="select2" data-placeholder="Select..." data-allow-clear="true" data-hide-search="true">
    <option></option>
    <option value="1">1</option>
    <option value="2">2</option>
    <option value="3">3</option>
    <option value="4">4</option>
    <option value="5">5</option>
    <option value="6">6</option>
    <option value="7">7</option>
    <option value="8">8</option>
    <option value="9">9</option>
    <option value="10">10</option>
    <option value="11">11</option>
    <option value="12">12</option>
    <option value="13">13</option>
    <option value="14">14</option>
    <option value="15">15</option>
    <option value="16">16</option>
    <option value="17">17</option>
    <option value="18">18</option>
    <option value="19">19</option>
    <option value="20">20</option>
    <option value="21">21</option>
    <option value="22">22</option>
    <option value="23">23</option>
    <option value="24">24</option>
    <option value="25">25</option>
    <option value="26">26</option>
    <option value="27">27</option>
    <option value="28">28</option>
    <option value="29">29</option>
    <option value="30">30</option>
    </select>
    <!--end::Input-->
    </div>
    <div class="fv-row mb-10 col-md-4">
    <!--begin::Label-->
    <label class="form-label required">Hour</label>
    <!--end::Label-->
    <!--begin::Input-->
    <?php
    $start = "00:00"; //you can write here 00:00:00 but not need to it
    $end = "23:45";

    $tStart = strtotime($start);
    $tEnd = strtotime($end);
    $tNow = $tStart;
    echo '<select name="hour" class="form-select form-select-lg form-select-solid" data-control="select2" data-placeholder="Select..." data-allow-clear="true" data-hide-search="true">';
    while($tNow <= $tEnd){
    echo '<option value="'.date("H:i",$tNow).'">'.date("H:i",$tNow).'</option>';
    $tNow = strtotime('+15 minutes',$tNow);
    }
    echo '</select>';
    ?>
    </div>
    </div>
    <div class="fv-row mb-10">
    <!--end::Label-->
    <label class="form-label">Reservation Notes</label>
    <!--end::Label-->
    <!--begin::Input-->
    <textarea name="notes" class="form-control form-control-lg form-control-solid" rows="3"></textarea>
    <!--end::Input-->
    </div>
    <div class="card-title m-0">
    <h3 class="fw-bolder m-0">Source Details</h3>
    </div>
    <div class="row">
    <div class="fv-row mb-10 col-md-6">
    <!--begin::Label-->
    <label class="form-label required">Source</label>
    <!--end::Label-->
    <!--begin::Input-->
    <select name="source" class="form-select form-select-lg form-select-solid" data-control="select2" data-placeholder="Select..." data-allow-clear="true" data-hide-search="true">
    <option></option>
    <option value="1">S Corporation</option>
    <option value="1">C Corporation</option>
    <option value="2">Sole Proprietorship</option>
    <option value="3">Non-profit</option>
    <option value="4">Limited Liability</option>
    <option value="5">General Partnership</option>
    </select>
    <!--end::Input-->
    </div>
    <div class="fv-row mb-10 col-md-6">
    <!--begin::Label-->
    <label class="form-label ">Source Name</label>
    <!--end::Label-->
    <!--begin::Input-->
    <select name="source_name" class="form-select form-select-lg form-select-solid" data-control="select2" data-placeholder="Select..." data-allow-clear="true" data-hide-search="true">
    <option></option>
    <option value="1">S Corporation</option>
    <option value="1">C Corporation</option>
    <option value="2">Sole Proprietorship</option>
    <option value="3">Non-profit</option>
    <option value="4">Limited Liability</option>
    <option value="5">General Partnership</option>
    </select>
    <!--end::Input-->
    </div>
    </div>
    <!--end::Input group-->
    </div>
    <!--end::Card body-->
    <!--begin::Actions-->
    <div class="card-footer d-flex justify-content-end py-6 px-9" id="password-security">
    <button type="reset" class="btn btn-light btn-active-light-primary me-2">İptal</button>
    <button type="submit" name="addreservation" class="btn btn-primary" >Kaydet</button>
    </div>
    <!--end::Actions-->
    </form>






    if (isset($_POST['addreservation'])) {

    $id=$_POST['id'];
    $ayarekle=$db->prepare("INSERT INTO reservations SET
    id=:id,
    date=:date,
    fullname=:fullname,
    phone=hone,
    mail=:mail,
    room=:room,
    pax=ax,
    hour=:hour,
    notes=:notes,
    source=:source,
    source_name=:source_name,
    reservation_agent=:reservation_agent,
    status=1
    ");

    $insert=$ayarekle->execute(array(
    'id' => $_POST['id'],
    'date' => $_POST['date'],
    'fullname' => $_POST['fullname'],
    'phone' => $_POST['phone'],
    'mail' => $_POST['mail'],
    'room' => $_POST['room'],
    'pax' => $_POST['pax'],
    'hour' => $_POST['hour'],
    'notes' => $_POST['notes'],
    'source' => $_POST['source'],
    'source_name' => $_POST['source_name'],
    'reservation_agent' => $_POST['reservation_agent']
    ));


    if ($insert) {

    Header("Location:../reservations.php?status=ok");

    } else {

    $a= error_reporting(E_ALL);
    echo $a;
    }

    }
  • 23-11-2021, 01:15:52
    #2
    hocam action ile bu sayfaya gidiyor. action="settings/edit-process.php"

    settings/edit-process.php sayfasına bunu koyun çalışır.


    if (isset($_POST['addreservation'])) {

    $id=$_POST['id'];
    $ayarekle=$db->prepare("INSERT INTO reservations SET
    id=:id,
    date=:date,
    fullname=:fullname,
    phone=hone,
    mail=:mail,
    room=:room,
    pax=ax,
    hour=:hour,
    notes=:notes,
    source=:source,
    source_name=:source_name,
    reservation_agent=:reservation_agent,
    status=1
    ");

    $insert=$ayarekle->execute(array(
    'id' => $_POST['id'],
    'date' => $_POST['date'],
    'fullname' => $_POST['fullname'],
    'phone' => $_POST['phone'],
    'mail' => $_POST['mail'],
    'room' => $_POST['room'],
    'pax' => $_POST['pax'],
    'hour' => $_POST['hour'],
    'notes' => $_POST['notes'],
    'source' => $_POST['source'],
    'source_name' => $_POST['source_name'],
    'reservation_agent' => $_POST['reservation_agent']
    ));


    if ($insert) {

    Header("Location:../reservations.php?status=ok");

    } else {

    $a= error_reporting(E_ALL);
    echo $a;
    }

    }
  • 23-11-2021, 01:16:43
    #3
    hocam o kodlar o sayfada zaten doğru yere gidiyor ancak calısmıyor
  • 23-11-2021, 01:19:30
    #4
    UretimAjansi adlı üyeden alıntı: mesajı görüntüle
    hocam o kodlar o sayfada zaten doğru yere gidiyor ancak calısmıyor
    hmm idyi kaydetmenize gerek yok id otomatik artması lazım.

    birde sqli gormem lazım ss atın sql yapısını
  • 23-11-2021, 01:24:12
    #5
    website adlı üyeden alıntı: mesajı görüntüle
    hmm idyi kaydetmenize gerek yok id otomatik artması lazım.

    birde sqli gormem lazım ss atın sql yapısını



    id alanlarını kaldırdım hocam sql yapısı bu sekılde
  • 23-11-2021, 01:24:56
    #6
    üstten yapıya tıklayın
  • 23-11-2021, 02:11:17
    #7
    @website; hocam desteğin için teşekkür ederim @ChostFreak; hocam any ile baglandı hallettik sorun yapı kısmında null olmamasıymıs