如何修复下拉菜单?所有选择显示“>&”;


How to fix drop down menu? All choices show ">"

这是我的下拉菜单代码。在一台服务器上,会显示相应的数字。但在另一个菜单中,我看到下拉菜单中的每个选项都显示">"。我猜这与php.ini文件有关,但我不确定。。。

<?php
// connect to the database
require 'connect.php';
// -------------------------------------------------------------------------------------------------------
// Drop Down Menu to choose Start and End dates
$startyear = ""; 
$startmonth = "";
$startday = "";
$endyear = "";
$endmonth = "";
$endday = "";
// Array of values for form
$year  = range(1998,2012);
$month = range(01,12);
$day   = range(01,31);
if($_SERVER['REQUEST_METHOD']=='POST')
{
    foreach($_POST as $key=>$value)
    {
        if(is_numeric($value))
        {
            $$key = $value;
        }
    }
}
?>
<form name='update' action='' method='POST'>
Start: <select name='startyear'>
    <?php foreach(array_reverse($year) as $y):?>
    <option value="<?=$y?>"<?=((isset($startyear) && $startyear == $y)?' selected':null)?>><?=$y?></option>
    <?php endforeach;?>
</select>
<select name='startmonth'>
    <?php foreach($month as $m): $m = str_pad($m, 2, "0", STR_PAD_LEFT);?>
    <option value="<?=$m;?>"<?=((isset($startmonth) && $startmonth == $m)?' selected':null)?>><?=$m;?></option>
    <?php endforeach;?>
</select>
    <select name='startday'>
    <?php foreach($day as $d): $d = str_pad($d, 2, "0", STR_PAD_LEFT);?>
    <option value="<?=$d;?>"<?=((isset($startday) && $startday == $d)?' selected':null)?>><?=$d;?></option>
    <?php endforeach;?>
</select>
<br>
End: <select name='endyear'>
    <?php foreach(array_reverse($year) as $y):?>
    <option value="<?=$y?>"<?=((isset($endyear) && $endyear == $y)?' selected':null)?>><?=$y?></option>
    <?php endforeach;?>
</select>
<select name='endmonth'>
    <?php foreach($month as $m): $m = str_pad($m, 2, "0", STR_PAD_LEFT);?>
    <option value="<?=$m;?>"<?=((isset($endmonth) && $endmonth == $m)?' selected':null)?>><?=$m;?></option>
    <?php endforeach;?>
</select>
    <select name='endday'>
    <?php foreach($day as $d): $d = str_pad($d, 2, "0", STR_PAD_LEFT);?>
    <option value="<?=$d;?>"<?=((isset($endday) && $endday == $d)?' selected':null)?>><?=$d;?></option>
    <?php endforeach;?>
</select>
<input type='submit' value='View'/>
</form>

尝试将短PHP标记替换为长标记。

<?=变为<?php echo<?变为<?php

某些配置允许您使用缩写形式;所有的PHP配置都允许您使用较长的配置。

更改:

selected':null)?>><?=$y?></option>

selected':null)?><?=$y?></option>

> 太多