You will want to use the a ternary operator which acts as a shortened IF/Else statement:
echo '<option value="'.$value.'" '.(($value=='United States')?'selected="selected"':"").'>'.$value.'</option>';
More Related Contents:
- how to make css work with php? [closed]
- Where can I find php.ini?
- List of Big-O for PHP functions
- How can I perform static code analysis in PHP? [closed]
- What are register_globals in PHP?
- php / Mysql best tree structure
- Why are my PHP files showing as plain text? [duplicate]
- How to write a REST API?
- How to find the dates between two specified date?
- strtotime With Different Languages?
- best practice to generate random token for forgot password
- Getting ’ instead of an apostrophe(‘) in PHP
- PHP Regex to check date is in YYYY-MM-DD format
- ALTER TABLE in Magento setup script without using SQL
- Autoload classes from different folders
- How do I get Greenwich Mean Time in PHP?
- Get user’s current location
- How do I enable php to work with postgresql?
- How to pass an array using PHP & Ajax to Javascript?
- PHP curly braces in array notation
- Remove trailing delimiting character from a delimited string
- XSS filtering function in PHP
- Is there a way to show a WHERE clause just for one field in MySQL?
- Warning: mysqli_query() expects parameter 1 to be mysqli, string given in
- send email with attachment using php
- Does PHP optimize tail recursion?
- Maximum length of generated hash when using password_hash?
- Set custom shipping rates programmatically in Woocommerce 3
- PHP Function with Optional Parameters [duplicate]
- Avoid public folder of laravel and open directly the root in web server