我有以下html代码:
<tr>
<td class="tablecontent" style="background-color: <?= $DATA_COLOR ?>;">
<?= $oLanguage->getExpression('optherapy', 'revisionIndikation', 'Indication') ?>
</td>
<td class="tablecontent" style="background-color: <?= $DATA_COLOR ?>;">
<select id="op5revindselect" name="cbOP5RevisionIndikation[]" multiple="multiple" data-placeholder="Mehrfachauswahl durch Ctrl/Strg + LMausClick ...">
<!-- <option><?= $oLanguage->getExpression('optherapy', 'revisionIndikationChoice', 'revision surgery - please choose') ?></option> !-->
<option value="1" <?=$ optherapie->getOP5RevisionIndikation() == '1' ? 'selected' : '' ?>>
<?= $oLanguage->getExpression('optherapy', 'revisionIndikation1', 'Inner Hernia (Meso)') ?>
</option>
<option value="2" <?=$ optherapie->getOP5RevisionIndikation() == '2' ? 'selected' : '' ?>>
<?= $oLanguage->getExpression('optherapy', 'revisionIndikation2', 'Inner Hernia (PETERSON)') ?>
</option>
<option value="3" <?=$ optherapie->getOP5RevisionIndikation() == '3' ? 'selected' : '' ?>>
<?= $oLanguage->getExpression('optherapy', 'revisionIndikation3', 'Weight Regain') ?>
</option>
<option value="4" <?=$ optherapie->getOP5RevisionIndikation() == '4' ? 'selected' : '' ?>>
<?= $oLanguage->getExpression('optherapy', 'revisionIndikation4', 'Weight Loss Failure') ?>
</option>
<option value="5" <?=$ optherapie->getOP5RevisionIndikation() == '5' ? 'selected' : '' ?>>
<?= $oLanguage->getExpression('optherapy', 'revisionIndikation5', 'Stenosis of Anastomosis') ?>
</option>
<option value="6" <?=$ optherapie->getOP5RevisionIndikation() == '6' ? 'selected' : '' ?>>
<?= $oLanguage->getExpression('optherapy', 'revisionIndikation6', 'Dysphagia') ?>
</option>
<option value="7" <?=$ optherapie->getOP5RevisionIndikation() == '7' ? 'selected' : '' ?>>
<?= $oLanguage->getExpression('optherapy', 'revisionIndikation7', 'Reflux') ?>
</option>
<option value="8" <?=$ optherapie->getOP5RevisionIndikation() == '8' ? 'selected' : '' ?>>
<?= $oLanguage->getExpression('optherapy', 'revisionIndikation8', 'Biliary Reflux') ?>
</option>
<option value="9" <?=$ optherapie->getOP5RevisionIndikation() == '9' ? 'selected' : '' ?>>
<?= $oLanguage->getExpression('optherapy', 'revisionIndikation9', 'Malnutrition') ?>
</option>
<option value="10" <?=$ optherapie->getOP5RevisionIndikation() == '10' ? 'selected' : '' ?>>
<?= $oLanguage->getExpression('optherapy', 'revisionIndikation10', 'Diarrhea') ?>
</option>
<option value="11" <?=$ optherapie->getOP5RevisionIndikation() == '11' ? 'selected' : '' ?>>
<?= $oLanguage->getExpression('optherapy', 'revisionIndikation11', 'Gastrogastric Fistula') ?>
</option>
<option value="12" <?=$ optherapie->getOP5RevisionIndikation() == '12' ? 'selected' : '' ?>>
<?= $oLanguage->getExpression('optherapy', 'revisionIndikation12', 'Perforation of an Ulcus') ?>
</option>
<option value="13" <?=$ optherapie->getOP5RevisionIndikation() == '13' ? 'selected' : '' ?>>
<?= $oLanguage->getExpression('optherapy', 'revisionIndikation13', 'Chronified Ulcus') ?>
</option>
<option value="14" <?=$ optherapie->getOP5RevisionIndikation() == '14' ? 'selected' : '' ?>>
<?= $oLanguage->getExpression('optherapy', 'revisionIndikation14', 'Chronified Pain') ?>
</option>
<option value="15" <?=$ optherapie->getOP5RevisionIndikation() == '15' ? 'selected' : '' ?>>
<?= $oLanguage->getExpression('optherapy', 'revisionIndikation15', 'Ileus') ?>
</option>
<option value="16" <?=$ optherapie->getOP5RevisionIndikation() == '16' ? 'selected' : '' ?>>
<?= $oLanguage->getExpression('optherapy', 'revisionIndikation16', 'Choledocholithiasis after Gastric Bypass ') ?>
</option>
<option value="17" <?=$ optherapie->getOP5RevisionIndikation() == '17' ? 'selected' : '' ?>>
<?= $oLanguage->getExpression('optherapy', 'revisionIndikation17', 'Leakage') ?>
</option>
</select>
</td>
</tr>
这是基于类的php代码中的html部分。
现在我想通过读取表字段的内容重新显示从数据库中选择的结果。内容以逗号分隔的方式保存,例如。g、 ““3,7,9,16“(参见mysql query:如何使用concat\ws和coalesce正确地识别逗号分隔的结果值并将其重新转换为原始概念)。
基于php类的读取方法被定义为。。。
public function read() {
global $UNDEFINEDDATE, $oDatabase, $oLanguage;
$rev = $this->getLastCRFRevisionNr();
$qBaseline = ' SELECT ' .
' timestamp, ' .
blah blah blah,
' OP2RevisionIndikation, ' .
blah blah blah
' FROM dat_optherapie ' .
" WHERE patID = $this->iPatientID " .
" and revision = $rev; ";
现在,读取这些数据的代码如下:
$haveOP1RevisionIndikation = explode(', ', $aBaselineData['OP1RevisionIndikation']);
$this->setOP1RevisionIndikation($haveOP2RevisionIndikation);
但是,这不足以在再次调用页面时以html显示输入的值。
我认为这最后两行是必要的。
有人知道怎么解决吗?
1条答案
按热度按时间2admgd591#
因为getter方法将返回
array('3', '7', '9', '16')
[用一个var_dump()
],你的情况将始终返回false(因为
array('3', '7', '9', '16') != '3'
).你想做的是
in_array
-支票,不是等额支票: