Forum Moderators: coopster
<input type="checkbox" name="some-name" value="some-val" checked>
I don't know of a singular, but in the context of a checkbox, it is set or it is not, an unchecked value will not be in post/get/request. Use this to your advantage when setting $recurring_event_mon:
$recurring_event_mon=($_POST['some-val'])?' checked':NULL;
echo '<input type="checkbox" name="some-name" value="some-val"' . $recurring_event_mon . '>';
but if your gonna code for the rest of your life saving a few characters saves time
The example you wrote saves you typing 4 characters...You'll find as you write more and more code that saving yourself typing is not the best approach to sometimes even the simplest -- or what may seem so at the time -- tasks. A MUCH better approach would be to write readable code and not worry so much about how much characters you are using. In the long run, writing readable code will save you much more time.
No.
Since PHP 5.3, it is possible to leave out the middle part of the ternary operator. Expression expr1 ?: expr3 returns expr1 if expr1 evaluates to TRUE, and expr3 otherwise.
Just a heads up.
[php.net...]
You don't need checked="checked", there's a savings right there.
If you're coding in xhtml, you do need 'checked="checked"' [w3.org]...
-- b