I have a series of HTML and PHP pages for an Incident Reporting system. The page I have to enter initial data works, and data is inserted into a MySQL DB. The data is mostly text, many with spaces.
The PHP page that I use to select the data from a previously entered Incident report also works, displaying the data including text with spaces.
Here is the issue: The PHP page that I wrote to update the DB truncates all text data that has a space that is a dropdown field. Text that is in a text field is not affected.
Here is some of my code:
The html page that creates the report has this code (for an example) and it creates the data correctly.
The edit php code does this:
php displays the data from:
and passes this:
and it truncates at first space in the DB "Level2".
BUT if you re-select it, then it goes into the DB without truncating. "Level2 - Non-permananet Harm"
It truncates the $sev data, if that makes sense.
I think the crux of the issue is that I am saying to update all fields, and when no change is made, the drop-down text data gets truncated.
I have tried wrapping $sev with single or double quotes but that just causes a PHP error. Is it a case where I have to somehow have it compare field by field and only update the changed fields?
TIA,
jej1216