I have a series of scripts that allow the user to a) create new data to insert into a MySQL DB, b) review that data, and c) change that data and do an update to the MySQL DB.
For a), I use a basic html form, and it passes a sample value like this:
[[HTML]Severity of Incident:
<select name="severity" size="1">
<option value="">Select a Severity Option</option>
<option value="Level1 - No Obvious Harm">Level 1 - No Obvious Harm</option>
<option value="Level2 - Non-permanent Harm">Level 2 - Non-permanent Harm</option>
<option value="Level3 - Semi-permanent Harm">Level 3 - Semi-permanent Harm</option>
<option value="Level4 - Major Permanent Harm">Level 4 - Major Permanent Harm</option>
<option value="Level5 - Death">Level 5 - Death</option>
</select>
[/HTML]
This inserts the full text into the DB, and it shows this full text for b).
For c), I use a php page, and it displays the value correctly using this:
[PHP]$sev=$myrow["severity"];[/PHP]
and
[PHP]<?php echo "<option value = ".$sev.">".$sev ."</option>"; ?>[/PHP] followed by the choices if needing to be changed:[HTML]<option value="Level1 - No Obvious Harm">Level 1 - No Obvious Harm</option>
<option value="Level2 - Non-permanent Harm">Level 2 - Non-permanent Harm</option>
<option value="Level3 - Semi-permanent Harm">Level 3 - Semi-permanent Harm</option>
<option value="Level4 - Major Permanent Harm">Level 4 - Major Permanent Harm</option>
<option value="Level5 - Death">Level 5 - Death</option>
</select>[/HTML]
If I re-select the same choice in the php page, the data is again submitted to the DB and the update is the full text value. If, however, I leave that data alone and submit, it gets truncated to 'Level2.'
The PHP page is not passing the [PHP]<?php echo "<option value = ".$sev.">".$sev ."</option>"; ?>[/PHP] value.
This issue occurs only for the drop down fields. I have other text fields that are not drop-downs and they do not truncate.
I have searched other posts and it seems I need to enclose $sev with quotes, but I get errors when I try that.
TIA,
jej1216
For a), I use a basic html form, and it passes a sample value like this:
[[HTML]Severity of Incident:
<select name="severity" size="1">
<option value="">Select a Severity Option</option>
<option value="Level1 - No Obvious Harm">Level 1 - No Obvious Harm</option>
<option value="Level2 - Non-permanent Harm">Level 2 - Non-permanent Harm</option>
<option value="Level3 - Semi-permanent Harm">Level 3 - Semi-permanent Harm</option>
<option value="Level4 - Major Permanent Harm">Level 4 - Major Permanent Harm</option>
<option value="Level5 - Death">Level 5 - Death</option>
</select>
[/HTML]
This inserts the full text into the DB, and it shows this full text for b).
For c), I use a php page, and it displays the value correctly using this:
[PHP]$sev=$myrow["severity"];[/PHP]
and
[PHP]<?php echo "<option value = ".$sev.">".$sev ."</option>"; ?>[/PHP] followed by the choices if needing to be changed:[HTML]<option value="Level1 - No Obvious Harm">Level 1 - No Obvious Harm</option>
<option value="Level2 - Non-permanent Harm">Level 2 - Non-permanent Harm</option>
<option value="Level3 - Semi-permanent Harm">Level 3 - Semi-permanent Harm</option>
<option value="Level4 - Major Permanent Harm">Level 4 - Major Permanent Harm</option>
<option value="Level5 - Death">Level 5 - Death</option>
</select>[/HTML]
If I re-select the same choice in the php page, the data is again submitted to the DB and the update is the full text value. If, however, I leave that data alone and submit, it gets truncated to 'Level2.'
The PHP page is not passing the [PHP]<?php echo "<option value = ".$sev.">".$sev ."</option>"; ?>[/PHP] value.
This issue occurs only for the drop down fields. I have other text fields that are not drop-downs and they do not truncate.
I have searched other posts and it seems I need to enclose $sev with quotes, but I get errors when I try that.
TIA,
jej1216
Comment