[web-php] redesign-downloads-page-prototype: Fix selection for usage
| From: | Sergey Panteleev | Date: | Thu, 03 Jul 2025 11:44:42 +0000 |
| Subject: | [web-php] redesign-downloads-page-prototype: Fix selection for usage | ||
| Groups: | php.webmaster | ||
| Request: | Send a blank email to php-webmaster+get-32978@lists.php.net to get a copy of this message | ||
Author: Sergey Panteleev (saundefined)
Date: 2025-07-03T14:31:44+03:00
Commit: https://github.com/php/web-php/commit/23b1eb614fb49608ae5035c274e9c9f46ed82750
Raw diff: https://github.com/php/web-php/commit/23b1eb614fb49608ae5035c274e9c9f46ed82750.diff
Fix selection for usage
Changed paths:
M downloads.php
Diff:
diff --git a/downloads.php b/downloads.php
index 6b8d3f46e8..99d2a0cf09 100644
--- a/downloads.php
+++ b/downloads.php
@@ -96,7 +96,9 @@ function option(string $value, string $desc, $attributes = []): string
I want to use PHP for
<select id="usage" name="usage">
<?php foreach ($usage as $value => $description) { ?>
- <?= option($value, $description); ?>
+ <?= option($value, $description, [
+ 'selected' => array_key_exists('usage', $options)
&& $options['usage'] === $value,
+ ]); ?>
<?php } ?>
</select>.
</div>