我的代码中包含以下复选框:
Echo "<p>Some text go here (I NEED TO PUT HERE CHECKBOX CHECKED FROM IF), here goes another text.</p>"
if( isset( $_POST['check'] ))
{
if( count( $_POST['check'] ) > 0 )
{
echo "" . implode(", ", $_POST['check']);
}
我需要将if from checkbox数组放在echo的中间,这是一种方式吗?
韩国社交协会
答案 0 :(得分:0)
如果你将值赋给变量,你可以把它(这个词......)变成一个echo命令。
if( isset( $_POST['check'] ))
{
if( count( $_POST['check'] ) > 0 )
{
$var = implode(", ", $_POST['check']);
} else {
$var = "";
}
echo "<p>Some text go here" . $var . ", here goes another text.</p>";
修改强>
添加了Mark的评论,作为上述echo命令的更有效方式:
echo "<p>Some text go here", $var, ", here goes another text.</p>";