douwei4370
douwei4370
2015-12-30 19:06

语法中出现意外的其他错误? [关闭]

  • json
  • php

I have the following code that keeps giving me an "unexpected else" error. Does anyone see something that I missed that is jacking with the syntax?

<?php
$salesman = json_decode($invoice['salesman'], true);
if(empty($salesman)){
  for($i = 1; $i <= 5; $i++) {
    echo '<input type="checkbox" name="data-invoice-salesman[]" value="'.$i.'"/> '.$i.'<br>';
} else {
  foreach($salesman as $k => $v) {
    $i = $k+1;
    if($v == "checked" {
      echo '<input type="checkbox" name="data-invoice-salesman[]" value="'.$i.'" checked/> '.$i.'<br>'; // if checked, check.
    } else {
      echo '<input type="checkbox" name="data-invoice-salesman[]" value="'.$i.'"/> '.$i.'<br>'; // if not checked, don't check.
    }
  }
}
  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

1条回答