, ,

“if your php page is submitting directly without filling data fields to the next php page in crud operation.” How can you fix it?

Posted by

If you’re working on a Crud operation in PHP and directly submitting your data insertion php page with or without filling data fields to the next operation page. And it will redirect to the next php page without alertness and filling data. it doesn’t show the alert message above the php page after clicking on the submit button. it is continuously redirecting to another PHP crud page with adding data. And you’re finding an image like this which is below-mentioned here.

Crud Operation in PHP

I have a solution for you and it really works on my PHP crud operation. if you shall put the below-mentioned code on your php creation page under the php code then it will definitely work on your php page or crud operation page. In the below-mentioned code, update.php is another php page that you want to redirect to it and the only you need to do is you will have to give a location to that.

if (mysqli_query($conn, $sql)) {
        // echo "New record created successfully <hr>";
        header('location:update.php');
    } else {
        echo "Unable to Insert Data";
    }
guest

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x