How do display checked value in checkbox on Google plus style popup box?
- by user946742
After reading this post on Stackoverflow
Google plus popup box when hovering over thumbnail? I was inspirted to add it on my site.
I managed to do so and the script adds the contacts to my database. So far awesome!
However, my problem (and also appears in the example) is it does not display the "checked" value... so the user will never know if they already added them to their list or not.
Is the correct way to display checked values with PHP?
Here is my html code:
<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>
And my PHP code is:
if($circle_check_friends>0) {
$ckecked1='checked=""';
} else if ($circle_check_following>0) {
$ckecked2='checked=""';
} else if ($circle_check_family>0) {
$ckecked3='checked=""';
} else if ($circle_check_acquaintances>0) {
$ckecked4='checked=""';
} else if ($circle_check_friends=0) {
$ckecked1='';
} else if ($circle_check_following=0) {
$ckecked2='';
} else if ($circle_check_family=0) {
$ckecked3='';
} else if ($circle_check_acquaintances=0) {
$ckecked4='';
}
Im lost because this is not giving me the result I want... i.e. for the checked values to be displayed according to the users choice.
Your help is highly appreciated
Thank you all in advance
George