Php form

Website URL

My website is

Php form submitted by post method getting truncated at the end from last 12 hours sometime. Its not happening always but sometimes it happens. Please help.

Hi Mayur14,

By truncated do you mean the submitted data are gone, or the last bit of the form data is not received? It means or describes different issues.



It maybe receiving but sometimes last bit of text is not showing

Hi Mayur14,

Sounds like your table column is not wide enough, consider altering the column to be a larger type, e.g. LONGTEXT to save more data.

Alternatively, let your users know that there’s a word limit to avoid large pastes. This is not a hosting or programming issue but more like the need to adjust settings.



I am saving form data in file not in database

I just double check again its showing complete text for now but it may happen again. I am not sure . Thanks for your help

Hi Mayur14,

Sounds a bit risky to me considering the case when 2 people submit at the same time and both PHP processes are writing to the same file, you will also encounter this issue, both processes race for writing to the file and the last process that gets the file handle will have the final version saved. Meaning if handle A gets the file and writes 20% of it and B takes the handle and writes everything, you get only the first bit of A’s content and B’s content.

Consider saving data to a database with transactions to avoid this issue. In this case, it’s a programming issue as I’ve never expected the practise of writng to file.

and yes, the last entry should always have full content as the last handle can complete writing if not interrupted.



Its happening again. I am the only person who is using that from .i am using that from to update html php pages code.
its problem in reading file as sometimes it show full text/code and someone its doesn’t show last line.
This problem is happening on imgeditornew.php file when submitting by form.I am not sure about other files

You guys are so helpful. Thanks for helping me.

Hi Mayur14,

If I am reading this correctly, the fact that you allow direct web form edits to your PHP code is a whole new level of concern, even if behind a login session.

You should never expose any remote code execution possibility on your website as this may have much higher consequences not only to your website. Imagine some genius dude decides to paste a hack tool there and visit your website. Guess what, your site is hacked, and it could be used as a jumper to target someone else on your name.

Please first temporarily take the page down, then show us the code here and we’ll guide you through safely on how things should be done the safe way. Do not expose this page before the code is completely safe checked.



I took the page down & change password too.
still same problem happening with many html and php pages.
Its truncating last lines of text. Its not showing last line even in your online file manager .

I’ve been trying to follow the conversation, but I still don’t quite understand how your things are working or supposed to work on your site. You say “it’s” truncating the last lines of text, but I don’t understand what “it” is.

Can you share some relevant code snippets to show how you’re interacting with the files? Even better if the code is complete enough we can reproduce it ourselves.


Hi admin,

The PHP code.

Same thing I’m requesting.

Hi Mayur14,

Whenever you’re trying to store data in files instead of the database, there’s no guarantee that there is only one file handle that exists, and that includes reading the page as well. In programming, only transactions can guarantee completeness in the database, that’s why we put data there anyway.

Program your code such that it stores the data part in the database, if you need to change your PHP frequently, use FTP. Trying have a web interface to change PHP code on the fly isn’t something that sounds secure and feasible anyways. Simply put, that’s not the right tool.


1 Like

Yes, I gathered that part.

What I don’t know is what PHP code is used or how it works. Is it using file_put_contents? Or fopen? Or something else? Does it also read the file before writing?

How are the updated file contents created? And are we sure that the data that’s supposed to be written is actually correct? Because of course, if you try to write incomplete data to a file, you will get a file with incomplete data, no matter what method of storage you use.

To each their own. There are plenty of downsides to having a web based code editor of course, but “files are not written completely” should not be one. And there are situations where having such a code editor does make sense.


I was talking about last line .
The file editor (this site online file manager) was only half line of last line sometime like

<script src="editimg.js


Sometime it was showing full line like screenshot .its showing full line for now.

Hi Mayur14,

Do you mean using the file editor that comes with the hosting platform causes/has this issue? This is completely different from what we perceived as you coding a web editor for your files. The hosting editor is not part of the PHP ecosystem, it’s something that controls/manage it.



This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.