Warning: Use of undefined constant _ - assumed '_' (this will throw an Error in a future version of PHP) in D:\xampp\htdocs\keuangan_rs\aksi_konten.php on line 52

elseif($aksi=="edit" AND $_POST['submit']){ 
    $nama = $_POST['nama_projek']; 
    $lokasi = $_POST['lokasi']; 
    $item = $_POST['item_pekerjaan']; 
    $nilai = $_POST['nilai_projek']; 
    $owner = $_POST['owner']; 
    $inisial = strtoupper($_POST['inisial_owner']); 
    $pic_owner = $_POST['pic_owner']; 
    $tanggal = $_POST['tanggal']; 
    $lama = $_POST['lama_pekerjaan']; 
    $file = $_FILES['gambar']['name']; 
    $acak = rand(1,99); 
    $filename = $acak._.$file; -------------------->online 52

Problem lies in this line:

$filename = $acak._.$file; 

It should be

$filename = $acak.'_'.$file; 
  • not going work @Krzysiek Dróżdż. Any thing matter – Sutan Ilhamsyah Siregar Mar 6 '19 at 17:17
  • 3
    @SutanIlhamsyahSiregar well, it will work, because you want to use these 2 variables as strings and concatenate them using "_" as divider. You can't concatenate variables with _, because there is no such constant in PHP. – Krzysiek Dróżdż Mar 6 '19 at 17:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.