我有这个在特定网址输入 selected="" 的 php 代码。我需要 selected="" 插入到我的 html 中。
<?php
$uri = $_SERVER['REQUEST_URI'];
if ( strpos($uri,'retailers/amazon/?sort=2') !== false ) {
echo 'selected=""';
} else {
echo 'test';
}
?>
这是 html,我需要插入 selected=""... 这样的东西
<option selected="" value="retailers/amazon/?sort=2">Newest to Oldest</option>
...
<select onchange="window.location=this.value;">
<option value="">Select</option>
<option selected="" value="retailers/amazon/?sort=2">Newest to Oldest</option>
<option value="retailers/amazon/?r_sortby=highest_rated&r_orderby=desc">Success Rate: High to Low</option>
<option value="retailers/amazon/?r_sortby=highest_rated&r_orderby=asc">Success Rate: Low to High</option>
<option value="retailers/amazon/?sort=0">Most Comments</option>
</select>