I have a full list of timezones in a select menu like so:
<option value="Pacific/Kosrae"> Pacific/Kosrae( +11:00 GMT ) </option>
<option value="Pacific/Kwajalein"> Pacific/Kwajalein( +12:00 GMT ) </option>
<option value="Pacific/Majuro"> Pacific/Majuro( +12:00 GMT ) </option>
<option value="Pacific/Marquesas"> Pacific/Marquesas( -09:30 GMT ) </option>
<option value="Pacific/Midway"> Pacific/Midway( -11:00 GMT ) </option>
the list goes on forever.
I want to change each of the options into this format:
if($_SESSION['timezone'] == 'Africa/Abidjan') {
echo '<option selected="selected" value="Africa/Abidjan"> Africa/Abidjan( +00:00 GMT ) </option>';
} else {
echo '<option value="Africa/Abidjan"> Africa/Abidjan( +00:00 GMT ) </option>';
}
How can I use php to avoid having to copy paste and edit each of the options manually??