回答編集履歴
2
調整
test
CHANGED
@@ -29,16 +29,18 @@
|
|
29
29
|
# デフォルト値を調整
|
30
30
|
```PHP
|
31
31
|
<?PHP
|
32
|
+
$min=22;
|
33
|
+
$max=70;
|
32
34
|
$agemin=filter_input(INPUT_GET,"AgeMin",FILTER_VALIDATE_INT);
|
33
35
|
$agemax=filter_input(INPUT_GET,"AgeMax",FILTER_VALIDATE_INT);
|
34
36
|
if($agemax<$agemin) $agemax=false;
|
35
|
-
if(empty($agemin)) $agemin=
|
37
|
+
if(empty($agemin)) $agemin=$min;
|
36
|
-
if(empty($agemax)) $agemax=
|
38
|
+
if(empty($agemax)) $agemax=$max;
|
37
39
|
?>
|
38
40
|
<form>
|
39
41
|
<select class="selectHide" name="AgeMin" id="AgeMin">
|
40
42
|
<?PHP
|
41
|
-
array_walk(range(
|
43
|
+
array_walk(range($min,$max),function($x) use($agemin){
|
42
44
|
$selected=$x==$agemin?" selected":"";
|
43
45
|
print "<option value=\"$x\"$selected>$x</option>".PHP_EOL;
|
44
46
|
});
|
@@ -46,7 +48,7 @@
|
|
46
48
|
</select>
|
47
49
|
<select class="selectHide" name="AgeMax" id="AgeMax">
|
48
50
|
<?PHP
|
49
|
-
array_walk(range(
|
51
|
+
array_walk(range($min,$max),function($x) use($agemax){
|
50
52
|
$selected=$x==$agemax?" selected":"";
|
51
53
|
print "<option value=\"$x\"$selected>$x</option>".PHP_EOL;
|
52
54
|
});
|
1
調整
test
CHANGED
@@ -26,3 +26,32 @@
|
|
26
26
|
<input type="submit" value="send">
|
27
27
|
</select>
|
28
28
|
```
|
29
|
+
# デフォルト値を調整
|
30
|
+
```PHP
|
31
|
+
<?PHP
|
32
|
+
$agemin=filter_input(INPUT_GET,"AgeMin",FILTER_VALIDATE_INT);
|
33
|
+
$agemax=filter_input(INPUT_GET,"AgeMax",FILTER_VALIDATE_INT);
|
34
|
+
if($agemax<$agemin) $agemax=false;
|
35
|
+
if(empty($agemin)) $agemin=22;
|
36
|
+
if(empty($agemax)) $agemax=70;
|
37
|
+
?>
|
38
|
+
<form>
|
39
|
+
<select class="selectHide" name="AgeMin" id="AgeMin">
|
40
|
+
<?PHP
|
41
|
+
array_walk(range(22,70),function($x) use($agemin){
|
42
|
+
$selected=$x==$agemin?" selected":"";
|
43
|
+
print "<option value=\"$x\"$selected>$x</option>".PHP_EOL;
|
44
|
+
});
|
45
|
+
?>
|
46
|
+
</select>
|
47
|
+
<select class="selectHide" name="AgeMax" id="AgeMax">
|
48
|
+
<?PHP
|
49
|
+
array_walk(range(22,70),function($x) use($agemax){
|
50
|
+
$selected=$x==$agemax?" selected":"";
|
51
|
+
print "<option value=\"$x\"$selected>$x</option>".PHP_EOL;
|
52
|
+
});
|
53
|
+
?>
|
54
|
+
</select>
|
55
|
+
<input type="submit" value="send">
|
56
|
+
</select>
|
57
|
+
```
|