语法错误:代码点火器中出现意外'.'?



我有一个错误,比如

类型:解析错误

消息:语法错误,意外的".">

文件名:/opt/lampp/htdocs/cctv/application/views/edit_camera.php

我的错误在哪里?

<div style="margin-top: " class="form-group">
<label>Terminal</label>
<select class="form-control input-lg" id="required" name='id_terminal' data-placeholder="Pilih transaksi">
<?php foreach ($get_camera as $cam) { 
if ($cam->id_camera == $this->uri->segment(3)) {
foreach ($terminal as $ter) { 
if($ter->id_terminal == $cam->id_terminal) { ?>
<?php echo "<option ".($cam->id_terminal == $ter->id_terminal ? ." selected='selected'".).">".$ter->nama_terminal."</option>" ?>
<?php   }
}
} ?>
<?php } ?>
</select>
</div>

此行

<?php echo "<option ".($cam->id_terminal == $ter->id_terminal ? ." selected='selected'".).">".$ter->nama_terminal."</option>" ?>

应改为

<?php echo "<option ".($cam->id_terminal == $ter->id_terminal ? " selected='selected'" : '').">".$ter->nama_terminal."</option>" ?>

您只是为字符串连接添加了太多的".",并且错过了三元运算符上的":"。

你应该尝试这种方式,你连接字符串的方式有问题:

<div style="margin-top: " class="form-group">
<label>Terminal</label>
<select class="form-control input-lg" id="required" name='id_terminal' data-placeholder="Pilih transaksi">
<?php 
foreach ($get_camera as $cam) { 
if ($cam->id_camera == $this->uri->segment(3)) {
foreach ($terminal as $ter) { 
if($ter->id_terminal == $cam->id_terminal) {
echo "<option ".($cam->id_terminal == $ter->id_terminal ? " selected='selected'":'').">".$ter->nama_terminal."</option>";
}
}
} 
} 
?>
</select>
</div>

相关内容

  • 没有找到相关文章

最新更新