I have an error like
Type: ParseError
Message: syntax error, unexpected '.'
Filename: /opt/lampp/htdocs/cctv/application/views/edit_camera.php
where's my error?
<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>
This line
<?php echo "<option ".($cam->id_terminal == $ter->id_terminal ? ." selected='selected'".).">".$ter->nama_terminal."</option>" ?>
should be changed to
<?php echo "<option ".($cam->id_terminal == $ter->id_terminal ? " selected='selected'" : '').">".$ter->nama_terminal."</option>" ?>
You have simply added too much "." for string concatenation, and missed the ":" on the ternary operator.
You should try this way, there is issue with the way you concatenat string :
<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>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.