cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Data not updating in database

Data is not updating in database from php page.

All things were fine, suddenly data is not updating in database. No any error occurs or not showing any error even error log is fine there is not any error reported, however data is not updating in database. Even mailto() is sending to customer data but data is not updating in database. 

<?PHP 
$name = $_FILES['file']['name'];
$target_dir = "uploads/";
$target_file = $target_dir . basename($_FILES["file"]["name"]);	  
$fnam= $_POST['fname'];
$mnam= $_POST['mname'];
$lnam= $_POST['lname'];
$fathe= $_POST['father'];
$cni= $_POST['cnic'];
$contac= $_POST['contact'];
$scontac= $_POST['scontact'];
$addres= $_POST['address'];
$emai= $_POST['email'];
$sec= $_POST['sect'];
$share= $_POST['shares'];
$sh1= $_POST['1s1'];
$sh2= $_POST['2s2'];
$sh3= $_POST['3s3'];
$sh4= $_POST['4s4'];
$sh5= $_POST['5s5'];
$sh6= $_POST['6s6'];
$sh7= $_POST['7s7'];
$delop= $_POST['delopt'];
$di= $_POST['dis'];
$do= $_POST['don'];
$comment= $_POST['comments'];


// Select file type
 $imageFileType = strtolower(pathinfo($target_file,PATHINFO_EXTENSION));

 // Valid file extensions
 $extensions_arr = array("jpg","jpeg","png","gif");
	  





$sql = "INSERT INTO submitdetails (fname, mname, lname, father, cnic, contact, scontact, address, email, sect, shares, s1, s2, s3, s4, s5, s6 , s7, delopt, dis, don, evidence, comments)
VALUES ('$fnam', '$mnam', '$lnam', '$fathe', '$cni', '$contac', '$scontac', '$addres', '$emai', '$sec', '$share', '$sh1', '$sh2', '$sh3', '$sh4', '$sh5', '$sh6', '$sh7', '$delop', '$di', '$do', '$name', '$comment')";
 if( in_array($imageFileType,$extensions_arr) ){

if ($conn->query($sql) === TRUE) {
    echo "New record created successfully";
	// Upload file
  move_uploaded_file($_FILES['file']['tmp_name'],$target_dir.$name);

} else {
    echo "Error: " . $sql . "<br>" . $conn->error;
}
	 }
	  ?>
 
    <!-- Submit Section -->
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
     <section id="about">
      <div class="container">
       
       <h1>Thank You...
       <?php
		   
		

$to = $emai;
$subject = "New Inquiry from Al-Haram Cattle Farm";

$htmlContent = '
    <html>
    <head>
        <title>Welcome to Al haram cattle farm</title>
    </head>
    <body>
        <h1>Thanks you for joining with us...! Our Representative call back you soon.</h1>
        <table cellspacing="0" style="border: 2px dashed #FB4314; width: 300px; height: 200px;">
            <tr>
                <th>Name:</th><td>Al haram cattle farm</td>
            </tr>
            <tr style="background-color: #e0e0e0;">
                <th>Email:</th><td>contact@alharamcattle.com</td>
            </tr>
            <tr>
                <th>Website:</th><td><a href="http://www.alharamcattlefarm.com">www.alharamcattlefarm.com</a></td>
            </tr>
        </table>
    </body>
    </html>';

// Set content-type header for sending HTML email
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";

// Additional headers
$headers .= 'From: contact@alharamcattlefarm.com' . "\r\n";
$headers .= 'Cc: fahdabas@gmail.com' . "\r\n";
$headers .= 'Bcc: muneebbinrauf@gmail.com' . "\r\n";

// Send email
if(mail($to,$subject,$htmlContent,$headers)):
    $successMsg = 'Email has sent successfully.';
else:
    $errorMsg = 'Email sending fail.';
endif;



       	   
		   
		   echo $fnam;
       ?>