0

Here goes the code :

<?php 
    include 'koneksi.php';

    $nama = $_POST['nama'];
    $email = $_POST['email'];
    $password = $_POST['password'];
    $fakultas = $_POST['fakultas'];
    $prodi = $_POST['prodi'];

    $masuk = "INSERT INTO `datapendaftar`(`nama`, `email`, `password`, `fakultas`, `prodi`) VALUES ($nama,$email,$password,$fakultas,$prodi)";
    $hasil_masuk = mysqli_query($sql,$masuk);

    echo "Terima kasih sudah mendaftar <br>";
    echo "Berikut adalah data yang masuk : <br>";
    echo "Nama : $nama <br>";
    echo "Email : $email <br>";
    echo "Fakultas : $fakultas <br>";
    echo "Prodi : $prodi <br>";
    echo "Silahkan kembali <a href = index.php><br><input type = submit value ='Kembali'> ";

 ?>

It can't add to mysql database. but when I run on form html, it works as well, but not sent to mysql database

  • There are multiple issues here. Step 1, user error reporting. Don't put user data in SQL, parameterize. Don't store plain text passwords. – user3783243 Mar 22 '20 at 04:42
  • 1
    or debatable a dup of https://stackoverflow.com/questions/11321491/when-to-use-single-quotes-double-quotes-and-backticks-in-mysql, but really the first, this would just temporarily resolve the issue. – user3783243 Mar 22 '20 at 04:44

0 Answers0