Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何在Google plus样式的弹出框中显示复选框中的选中值?_Php_Ajax_Checkbox_Google Plus - Fatal编程技术网

Php 如何在Google plus样式的弹出框中显示复选框中的选中值?

Php 如何在Google plus样式的弹出框中显示复选框中的选中值?,php,ajax,checkbox,google-plus,Php,Ajax,Checkbox,Google Plus,在阅读了Stackoverflow上的这篇文章之后 我被激励在我的网站上添加它 我成功地做到了这一点,脚本将联系人添加到我的数据库中。到目前为止棒极了 但是,我的问题(也出现在示例中)是它没有显示“选中”值。。。因此,用户永远不会知道他们是否已经将其添加到列表中 使用PHP显示选中值的正确方法是什么 以下是我的html代码: <ul style="list-style: none;padding:2px;"> <li style="padding:5px 2px;"> &

在阅读了Stackoverflow上的这篇文章之后 我被激励在我的网站上添加它

我成功地做到了这一点,脚本将联系人添加到我的数据库中。到目前为止棒极了

但是,我的问题(也出现在示例中)是它没有显示“选中”值。。。因此,用户永远不会知道他们是否已经将其添加到列表中

使用PHP显示选中值的正确方法是什么

以下是我的html代码:

<ul style="list-style: none;padding:2px;">
<li style="padding:5px 2px;">
<input type="checkbox" id="Friends" name="circles" value="Friends" '.$checked1.'/>
            Friends
</li>
<li style="padding:5px 2px;">
<input type="checkbox" id="Following" name="circles" value="Following" '.$checked2.'/>Following
</li>
<li style="padding:5px 2px;">
<input type="checkbox" id="Family" name="circles" value="Family" '.$checked3.'/>
            Family
</li>
<li style="padding:5px 2px;">
<input type="checkbox" id="Acquaintances" name="circles" value="Acquaintances" '.$checked4.'/>
            Acquaintances
</li>
</ul>
我迷路了,因为这并没有给我想要的结果。。。i、 e.根据用户选择显示检查值

非常感谢你的帮助

提前谢谢大家

乔治

试试这个:

$checked1 = ($circle_check_friends == 1) ? 'checked=""' : false;
$checked2 = ($circle_check_following == 1) ? 'checked=""' : false;
$checked3 = ($circle_check_family == 1) ? 'checked=""' : false;
$checked4 = ($circle_check_acquaintances == 1) ? 'checked=""' : false;
粘贴所有代码,以便我们可以轻松修复
$checked1 = ($circle_check_friends == 1) ? 'checked=""' : false;
$checked2 = ($circle_check_following == 1) ? 'checked=""' : false;
$checked3 = ($circle_check_family == 1) ? 'checked=""' : false;
$checked4 = ($circle_check_acquaintances == 1) ? 'checked=""' : false;