php - Error Index undefined when i try send from android to mysql database -
so made menu send data android mysql database, when press send button error come, here php code(addkomen.php)
<?php if($_server['request_method']=='post'){ //getting values $nama = $_post['nama']; $email = $_post['email']; $isi = $_post['isi']; //creating sql query $sql = "insert email (nama,email,isi) values ('$nama','$email','$isi')"; //importing our db connection script require_once('dbconnect.php'); //executing query database if(mysqli_query($con,$sql)){ echo 'added successfully'; }else{ echo 'could not add'; } //closing database mysqli_close($con); }
?>
so problem in android code, because type different variable answer , problem in android code. best regards
you not posting data correctly, , resolve undefined index: nama
use isset()
check whether index trying exist or not like:
if( isset( $_post['nama'] ) ) { // block execute if nama have value in it. }
Comments
Post a Comment