Hi
Any one Can Assist me in this problem.. I have dynamic page, Where I can type and save and edit it is working fine.. But when I copy past any other data from other website site it is giving the below mention error. Note: When I copy two or three paragraph from other website it is having this error. |
Solved: This line is used to replace the ' from the content updated by the user else it will show error while updating the page
Code: $servicesdetails1 = str_replace("'","\'", $servicesdetails1 );
<?php
if(isset($_POST['update12'])){
$update_id = $_GET['edit_form1'];
$servicesname1 = $_POST['title'];
$servicesdetails1 = $_POST['content'];
$servicesdetails1 = str_replace("'","\'", $servicesdetails1 );
$servicesimage1= $_FILES['image']['name'];
$image_tmp= $_FILES['image']['tmp_name'];
if( $servicesname1=='' or $servicesdetails1=='' ){
echo "<script>alert('Any of the fields is empty')</script>";
exit();
}
else {
move_uploaded_file($image_tmp,"../images/$servicesimage1");
$update_query = "update possystem set servicesname='$servicesname1', servicesdetails='$servicesdetails1',servicesimage='$servicesimage1' where id='$update_id'";
if(mysqli_query($conn, $update_query)){
/*echo "<script>alert('Post has been updated')</script>";
*/ echo "<script>window.open('view_possystem.php','_self')</script>";
}
}
}}
?>
No comments:
Post a Comment