[PHP-WEBMASTER] [web-php] redesign-downloads-page-prototype: Fix selection for usage

Author: Sergey Panteleev (saundefined)
Date: 2025-07-03T14:31:44+03:00

Commit: Fix selection for usage · php/web-php@23b1eb6 · GitHub
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>