I'm trying to edit and upload the details to the MYSQL database using PHP programming
The form having two dynamic dropdowns onClick event ajax function added an option getting from the database.
While editing.
while($res=mysqli_fetch_array($result)){
echo $description = $res['des'];
echo $frequency = $res['freq'];
echo $issuedate = $res['i_date'];
echo $validitydate = $res['v_date'];
echo $email = $res['e_mail'];
echo $datetosend = $res['d_to_send'];
}
Right here I'm getting
After that
<?php
if (isset($_POST['update'])) {
$id = $_POST['id'];
$description = mysqli_real_escape_string($conn,$_POST['description']);
$frequency = mysqli_real_escape_string($conn,$_POST['frequency']);
$issuedate = mysqli_real_escape_string($conn,$_POST['issuedate']);
$validitydate =mysqli_real_escape_string($conn,$_POST['validitydate']);
$email = mysqli_real_escape_string($conn,$_POST['email']);
$datetosend =mysqli_real_escape_string($conn,$_POST['datetosend']);
$result=mysqli_query($conn,"Update added_date SET des='$description', freq='$frequency', i_date='$issuedate', v_date='$validitydate',e_mail='$email',d_to_send='datetosend' ,Where id=$id");
if ($result) {
header("location:update_front.php");
}else{
echo "sorry";
}
}
?>
I am getting "Sorry". I want to update data using PHP with the MYSQL database but the else part is working well. I need that the update operation works well. I need help with data editing in PHP with MYSQL.