sorry if this quite a easy question, but i cant find any thread the same as this.
lets say we are setting the values like
<li><input type="checkbox" name="only_admin" value="1" /> Only Admin</li>
<li><input type="checkbox" name="can_request" value="1" /> Can Request</li>
<li><input type="checkbox" name="can_offer" value="1" /> Can Offer</li>
<li><input type="checkbox" name="can_post" value="1" /> Can Post</li>
<li><input type="checkbox" name="is_maintenance" value="1" /> Is Maintenance</li>
then on our server side we put this
if (isset($_POST['only_admin'])) {
$permission['only_admin'] = $_POST['only_admin'];
}
if (isset($_POST['can_request'])) {
$permission['can_request'] = $_POST['can_request'];
}
if (isset($_POST['can_offer'])) {
$permission['can_offer'] = $_POST['can_offer'];
}
if (isset($_POST['can_post'])) {
$permission['can_post'] = $_POST['can_post'];
}
if (isset($_POST['is_maintenance'])) {
$permission['is_maintenance'] = $_POST['is_maintenance'];
}
is there a simpler version to above code ?
thanks!
Adam Ramadhan
ps please tag me if there is already a good thread about this.*
1 Answer