• 12-07-2022, 15:17:23
    #1
    Arkadaşlar kullanıcı bilgi güncellemesini ajax ile yapmaya çalışıyorum ama hatam nerede bulamadım onclick de çift ve tek tırnakta denedim olmadı yardımcı olursanız sevinirim.

    Console den aldığım hata
    Uncaught ReferenceError: semihburcin is not defined
        at HTMLButtonElement.onclick
    Kodlar;

    <script type="text/javascript">
                function semihburcin(){
    
                    var semihsahin = $("#formguncelle").serialize();
                    $.ajax({
                        type = "POST",
                        date = semihsahin,
                        url  = "guncelle.php",
                        success : function(sem10line){
    
                            if($.trim(sem10line) == "bos"){
                                Swal.fire({
      position: 'top-end',
      icon: 'error',
      title: 'Güncelleme Başarısız',
      showConfirmButton: false,
      timer: 1500
    });
                            }else if($.trim(sem10line) == "ok"){
                                Swal.fire({
      position: 'top-end',
      icon: 'success',
      title: 'Güncelleme Başarılı',
      showConfirmButton: false,
      timer: 1500
    });
                            }
                        }
                    });
                }                                            
            </script>
                                            
                <form method="POST" id="formguncelle" onsubmit="return false">
                                <div class="col-md-12">
                                    <input type="text" class="form-control " name="ad" placeholder="Adınız" value="<?php echo $kullanici['ad']; ?>">
                                    <br>
                                    <input type="text" class="form-control " name="soyad" placeholder="Soyadınız" value="<?php echo $kullanici['soyad']; ?>">
                                    <br>
                                    <input type="text" class="form-control " name="telefon" placeholder="Telefon Numaranız" value="<?php echo $kullanici['telefon']; ?>">
                                    <br>
                                    <input type="text" class="form-control " name="email" placeholder="Email Adresiniz" value="<?php echo $kullanici['email']; ?>">
                                    <br>
                                    <input type="text" class="form-control " name="sifre" placeholder="Şifreniz" value="<?php echo $kullanici['sifre']; ?>">
                                    <br>
                                    <input type="text" class="form-control " name="il" placeholder="İl" value="<?php echo $kullanici['il']; ?>">
                                   <br>
                                    <input type="text" class="form-control" name="ilce" placeholder="İlçe" value="<?php echo $kullanici['ilce']; ?>">
                                   <br>
                                    <input type="text" class="form-control " name="adres" placeholder="Adresiniz" value="<?php echo $kullanici['adres']; ?>">
                                   <br>
                                   <input type="hidden" name="id" value="<?php echo $_SESSION['kullanici']['id'] ?>">
                                    <button class="btn btn-primary btn-lg " onclick='semihburcin();'><i class="fa fa-edit"></i> Bilgileri Güncelle</button>
                                </div>
                                </form>
    Güncelleme sayfası;
    <?php 
         require_once 'panel/baglan.php';
    
         if ($_POST) {
             $id = $_POST['id'];
             $ad = $_POST['ad'];
             $soyad = $_POST['soyad'];
             $telefon = $_POST['telefon'];
             $adres = $_POST['adres'];
             $il = $_POST['il'];
             $ilce = $_POST['ilce'];
             $email = $_POST['email'];
             $sifre = $_POST['sifre'];
    
             if (!$ad || !$soyad || !$telefon || !$adres || !$email || !$il || !$ilce || !$sifre || !$id) {
                 echo "bos";
             }else{
    
                 $guncelle = $db->prepare("UPDATE kullanici SET ad=:a, soyad=:b, telefon=:c, adres=:d, il=:e, ilce=:f, email=:g, sifre=:h WHERE id=:i");
                 $guncelle->execute(array(':a' => $ad, ':b' => $soyad, ':c' => $telefon, ':d' => $adres, ':e' => $il, ':f' => $ilce, ':g' => $email, ':h' => $sifre, ':i' => $id));
                 if ($guncelle) {
                     echo "ok";
                 }
             }
         }
    
     ?>
  • 12-07-2022, 15:59:59
    #2
    Merhaba,
    Anydesk atarsanız yardımcı olmaya çalışırım.
  • 12-07-2022, 16:03:13
    #3
    eypoffcl adlı üyeden alıntı: mesajı görüntüle
    Merhaba,
    Anydesk atarsanız yardımcı olmaya çalışırım.
    şuan atamam hocam dışardayım
  • 12-07-2022, 16:17:35
    #4
    Uncaught ReferenceError: semihburcin is not defined
    burada semihburcin tanımlı değil diyor.

    onclick='semihburcin();'bunu form a ekle o zaman olur sanırım
  • 12-07-2022, 16:28:55
    #5
    byroot adlı üyeden alıntı: mesajı görüntüle
    Uncaught ReferenceError: semihburcin is not defined
    burada semihburcin tanımlı değil diyor.

    onclick='semihburcin();'bunu form a ekle o zaman olur sanırım
    form içerisinde zaten
  • 12-07-2022, 16:32:24
    #6
    <form method="POST" id="formguncelle" onsubmit="return false"  onclick="semihburcin();"  >
                                <div class="col-md-12">
                                    <input type="text" class="form-control " name="ad" placeholder="Adınız" value="<?php echo $kullanici['ad']; ?>">
                                    <br>
                                    <input type="text" class="form-control " name="soyad" placeholder="Soyadınız" value="<?php echo $kullanici['soyad']; ?>">
                                    <br>
                                    <input type="text" class="form-control " name="telefon" placeholder="Telefon Numaranız" value="<?php echo $kullanici['telefon']; ?>">
                                    <br>
                                    <input type="text" class="form-control " name="email" placeholder="Email Adresiniz" value="<?php echo $kullanici['email']; ?>">
                                    <br>
                                    <input type="text" class="form-control " name="sifre" placeholder="Şifreniz" value="<?php echo $kullanici['sifre']; ?>">
                                    <br>
                                    <input type="text" class="form-control " name="il" placeholder="İl" value="<?php echo $kullanici['il']; ?>">
                                   <br>
                                    <input type="text" class="form-control" name="ilce" placeholder="İlçe" value="<?php echo $kullanici['ilce']; ?>">
                                   <br>
                                    <input type="text" class="form-control " name="adres" placeholder="Adresiniz" value="<?php echo $kullanici['adres']; ?>">
                                   <br>
                                   <input type="hidden" name="id" value="<?php echo $_SESSION['kullanici']['id'] ?>">
                                    <button class="btn btn-primary btn-lg "><i class="fa fa-edit"></i> Bilgileri Güncelle</button>
                                </div>
                                </form>
    böyle denermisin?
  • 12-07-2022, 18:12:19
    #7
    byroot adlı üyeden alıntı: mesajı görüntüle
    <form method="POST" id="formguncelle" onsubmit="return false"  onclick="semihburcin();"  >
                                <div class="col-md-12">
                                    <input type="text" class="form-control " name="ad" placeholder="Adınız" value="<?php echo $kullanici['ad']; ?>">
                                    <br>
                                    <input type="text" class="form-control " name="soyad" placeholder="Soyadınız" value="<?php echo $kullanici['soyad']; ?>">
                                    <br>
                                    <input type="text" class="form-control " name="telefon" placeholder="Telefon Numaranız" value="<?php echo $kullanici['telefon']; ?>">
                                    <br>
                                    <input type="text" class="form-control " name="email" placeholder="Email Adresiniz" value="<?php echo $kullanici['email']; ?>">
                                    <br>
                                    <input type="text" class="form-control " name="sifre" placeholder="Şifreniz" value="<?php echo $kullanici['sifre']; ?>">
                                    <br>
                                    <input type="text" class="form-control " name="il" placeholder="İl" value="<?php echo $kullanici['il']; ?>">
                                   <br>
                                    <input type="text" class="form-control" name="ilce" placeholder="İlçe" value="<?php echo $kullanici['ilce']; ?>">
                                   <br>
                                    <input type="text" class="form-control " name="adres" placeholder="Adresiniz" value="<?php echo $kullanici['adres']; ?>">
                                   <br>
                                   <input type="hidden" name="id" value="<?php echo $_SESSION['kullanici']['id'] ?>">
                                    <button class="btn btn-primary btn-lg "><i class="fa fa-edit"></i> Bilgileri Güncelle</button>
                                </div>
                                </form>
    böyle denermisin?
    Hocam evden çıktım döndüğümde deneyip dönüş sağlıcam