note 92507 added to language.operators.comparison

From: Date: Mon, 27 Jul 2009 20:58:53 +0000
Subject: note 92507 added to language.operators.comparison
Groups: php.notes 
Request: Send a blank email to php-notes+get-158794@lists.php.net to get a copy of this message
@Anonymous: any time you start copy/pasting things like whether to mark each individual checkbox as checked, you should really be looping over an array and only checking that condition once. There is no reason why you should ever have checked="checked" in your code more than once for options of the same list. Example: <? $gender = 'f'; ?> <form> <? foreach (array( 'm' => 'Male', 'f' => 'Female' ) as $value => $label): ?> <input type="radio" name="gender" value="<?= $value; ?>"<?= $gender == $value ? ' checked="checked"' : ''; ?>> <?= $label ?> <? endforeach; ?> </form> ---- Server IP: 66.207.199.35 Probable Submitter: 69.70.125.250 ---- Manual Page -- http://www.php.net/manual/en/language.operators.comparison.php Edit -- https://master.php.net/note/edit/92507 Del: integrated -- https://master.php.net/note/delete/92507/integrated Del: useless -- https://master.php.net/note/delete/92507/useless Del: bad code -- https://master.php.net/note/delete/92507/bad+code Del: spam -- https://master.php.net/note/delete/92507/spam Del: non-english -- https://master.php.net/note/delete/92507/non-english Del: in docs -- https://master.php.net/note/delete/92507/in+docs Del: other reasons-- https://master.php.net/note/delete/92507 Reject -- https://master.php.net/note/reject/92507 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#158794) next »