On Friday, December 19, 2003, at 01:35 PM, Philip J. Newman wrote:

<?php if ($_POST[formReviewBy]=="Cade Lloyd") { echo "selected"; } ?>

Should $_POST[formReviewBy] have quotes or dose it not matter?

Well, since you've obviously tested it and it works, then the simple answer is probably "it doesn't matter", however, all examples in the manual using string-keys that I can see (http://www.php.net/manual/en/language.types.array.php) use quote around the key.


You will DEFINITELY need them when the string key has a space or possibly other not-allowed characters, so my advice (which I follow myself) is to always include quotes around a string key.

$_POST['formReviewBy']=='Cade Lloyd') { echo 'selected'; }

No need for double quotes unless PHP needs to evaluate $vars or escaped chars (like \n or \t) either.


Justin French


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to