File tree 2 files changed +26
-12
lines changed
samples/Wizards/NumberFormat
2 files changed +26
-12
lines changed Original file line number Diff line number Diff line change 14
14
15
15
return ;
16
16
}
17
+
18
+ $ currencies = [
19
+ '$ ' => 'US Dollars ($) ' ,
20
+ '€ ' => 'Euro (€) ' ,
21
+ '¥ ' => 'Japanese Yen (¥) ' ,
22
+ '£ ' => 'Pound Sterling (£) ' ,
23
+ '₹ ' => 'Rupee (₹) ' ,
24
+ '₽ ' => 'Rouble (₽) ' ,
25
+ ];
26
+
17
27
?>
18
28
<form action=Accounting.php method="POST">
19
29
<div class="mb-3 row">
29
39
<label for="currency" class="col-sm-2 col-form-label">Currency</label>
30
40
<div class="col-sm-10">
31
41
<select name="currency" class="form-select">
32
- <option value="$" <?php echo (isset ($ _POST ['currency ' ]) && $ _POST ['currency ' ] === '$ ' ) ? 'selected ' : '' ; ?> >US Dollars ($)</option>
33
- <option value="€" <?php echo (isset ($ _POST ['currency ' ]) && $ _POST ['currency ' ] === '€ ' ) ? 'selected ' : '' ; ?> >Euro (€)</option>
34
- <option value="¥" <?php echo (isset ($ _POST ['currency ' ]) && $ _POST ['currency ' ] === '¥ ' ) ? 'selected ' : '' ; ?> >Japanese Yen (¥)</option>
35
- <option value="£" <?php echo (isset ($ _POST ['currency ' ]) && $ _POST ['currency ' ] === '£ ' ) ? 'selected ' : '' ; ?> >Pound Sterling (£)</option>
36
- <option value="₹" <?php echo (isset ($ _POST ['currency ' ]) && $ _POST ['currency ' ] === '₹ ' ) ? 'selected ' : '' ; ?> >Rupee (₹)</option>
37
- <option value="₽" <?php echo (isset ($ _POST ['currency ' ]) && $ _POST ['currency ' ] === '₽ ' ) ? 'selected ' : '' ; ?> >Rouble (₽)</option>
42
+ <?php foreach ($ currencies as $ currencySymbol => $ currencyName ) {
43
+ echo "<option value= \"{$ currencySymbol }\" " . ((isset ($ _POST ['currency ' ]) && $ _POST ['currency ' ] === $ currencySymbol ) ? 'selected ' : '' ) . "> {$ currencyName }</option> " , PHP_EOL ;
44
+ } ?>
38
45
</select>
39
46
</div>
40
47
</div>
Original file line number Diff line number Diff line change 14
14
15
15
return ;
16
16
}
17
+
18
+ $ currencies = [
19
+ '$ ' => 'US Dollars ($) ' ,
20
+ '€ ' => 'Euro (€) ' ,
21
+ '¥ ' => 'Japanese Yen (¥) ' ,
22
+ '£ ' => 'Pound Sterling (£) ' ,
23
+ '₹ ' => 'Rupee (₹) ' ,
24
+ '₽ ' => 'Rouble (₽) ' ,
25
+ ];
26
+
17
27
?>
18
28
<form action="Currency.php" method="POST">
19
29
<div class="mb-3 row">
29
39
<label for="currency" class="col-sm-2 col-form-label">Currency</label>
30
40
<div class="col-sm-10">
31
41
<select name="currency" class="form-select">
32
- <option value="$" <?php echo (isset ($ _POST ['currency ' ]) && $ _POST ['currency ' ] === '$ ' ) ? 'selected ' : '' ; ?> >US Dollars ($)</option>
33
- <option value="€" <?php echo (isset ($ _POST ['currency ' ]) && $ _POST ['currency ' ] === '€ ' ) ? 'selected ' : '' ; ?> >Euro (€)</option>
34
- <option value="¥" <?php echo (isset ($ _POST ['currency ' ]) && $ _POST ['currency ' ] === '¥ ' ) ? 'selected ' : '' ; ?> >Japanese Yen (¥)</option>
35
- <option value="£" <?php echo (isset ($ _POST ['currency ' ]) && $ _POST ['currency ' ] === '£ ' ) ? 'selected ' : '' ; ?> >Pound Sterling (£)</option>
36
- <option value="₹" <?php echo (isset ($ _POST ['currency ' ]) && $ _POST ['currency ' ] === '₹ ' ) ? 'selected ' : '' ; ?> >Rupee (₹)</option>
37
- <option value="₽" <?php echo (isset ($ _POST ['currency ' ]) && $ _POST ['currency ' ] === '₽ ' ) ? 'selected ' : '' ; ?> >Rouble (₽)</option>
42
+ <?php foreach ($ currencies as $ currencySymbol => $ currencyName ) {
43
+ echo "<option value= \"{$ currencySymbol }\" " . ((isset ($ _POST ['currency ' ]) && $ _POST ['currency ' ] === $ currencySymbol ) ? 'selected ' : '' ) . "> {$ currencyName }</option> " , PHP_EOL ;
44
+ } ?>
38
45
</select>
39
46
</div>
40
47
</div>
You can’t perform that action at this time.
0 commit comments