jquery - Disable all input buttons on page if no PHP session exists -
i'm doing site voting system. want disable input buttons (the ability vote) if user isnt logged in (ie. session doesnt exist). how do check in php @ top of page , allow/disallow input buttons? use css or jquery?
somewhere in code check if session not set:
if(!isset($_session['some_key'])){ $disable = true; }else{ $disable = false; }
then, in html:
<input type="radio" name="" value=""<?=($disable ? " disabled=\"disabled\"" : "");?>/> vote 1 <input type="radio" name="" value=""<?=($disable ? " disabled=\"disabled\"" : "");?>/> vote 2 <input type="radio" name="" value=""<?=($disable ? " disabled=\"disabled\"" : "");?>/> vote 3
but still have check @ serverside before accept vote, if person has voted before, because form can edited post data again , again.
Comments
Post a Comment