php - html php语法错误

标签 php syntax-error

可能是一个愚蠢的问题,但我无法弄清楚,我需要另一个人的观点。我猜测它的报价错误或什么,但错误是;

解析错误:语法错误,意外的“?”在第244行的C:\ xampp \ htdocs \ Joomla-Lifestyle \ components \ com_jumi \ files \ medication.php中

244行是;

echo '<input type="radio" name="med" value="med' . $count . '" '<?php if(isset($_POST['view'])) echo checked="checked"; ?>'>' . $MedEntriesName . '<br>';

这行代码是循环的,我只想在单击“查看”按钮时保持选中状态。

谢谢!

最佳答案

这样使用

<?php
    $checked = isset($_POST['view']) ? 'checked="checked"' : '';
    echo '<input type="radio" name="med" value="med'.$count.'" '.$checked.'>'.$MedEntriesName.'<br>';
?>

关于php - html php语法错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23169474/

相关文章:

php - Wordpress 查询预览?

php - 无效的 SMTPAPI header - SendGrid

php - 如何在 Laravel 中使用相同的 Blade 模板对一个 Controller 进行添加和编辑操作?

php - 如何在 Zend Framework 1.x 中执行简单的 Mysql SELECT DATEDIFF()

python - SyntaxError :invalid character in identifier. But I don't why it goes wrong

php - 您的SQL语法有误-PHP MYSQL

python - 获取 'NameError: name ' <我的函数 >' is not defined' 错误

php - 在 RegEx 中接受国际名称字符

mysql - 我该如何修复 : "...error in your SQL syntax; check the manual for the right syntax"

java - 错误 "main cannot be resolved or is not a field "