Hi I have problem with undefined index and when i submit send message for me Undefined index: agahicode in C:\wamp\www\Ehsan\user\edit-check.php on line 12 and not change in DataBase. please help me enter image description here
Notice: Undefined index: id in C:\wamp\www\member\index.php on line 17
Here is the code of Edit.php
<?php
include '../connect.php';
$sql="select * from agahi where code = ?";
$result=$connect->prepare($sql);
$result->bindValue(1,$_GET["agahicode"]);
$result->execute();
$tedad=$result->rowCount();
$data=$result->fetch(PDO::FETCH_OBJ) ;
?>
<script>
$(document).ready(function(e) {
$("#group").val(<?= $data->group ?>);
$("#city").val(<?= $data->city ?>);
$("#register").click(function(){
var title = $("#title").val();
var phone = $("#phone").val();
var gheymat = $("#gheymat").val();
var description = $("#description").val();
var group = $("#group").val();
var city = $("#city").val();
$.post("edit-check.php",{title:title,phone:phone,gheymat:gheymat,description:description,group:group,city:city},function(data){
$("#msg").html(data);
});
});
});
</script>
and Here is the code of edit-check.php
<?php
session_start();
include '../connect.php';
$sql="UPDATE `golestan`.`agahi` SET `title` = ?, `phone` = ?, `gheymat` = ?, `description` = ?, `group` = ?, `city` = ? WHERE `code` = ?;";
$result=$connect->prepare($sql);
$result->bindValue(1,$_POST["title"]);
$result->bindValue(2,$_POST["phone"]);
$result->bindValue(3,$_POST["gheymat"]);
$result->bindValue(4,$_POST["description"]);
$result->bindValue(5,$_POST["group"]);
$result->bindValue(6,$_POST["city"]);
$result->bindValue(7,$_POST["agahicode"]);
if($result->execute())
{
echo '<span style="color:green">ok</span>';
}
else
{
echo '<span style="color:red;">error</span>';
}
?>