Çalışma yaptığım web sitesinde bu şekilde bir çalışma sağlıyorum. Ancak if yapıları $_GET 'i görmüyor. g() kendi yazmış olduğum fonksiyondur.
<div class="product__view--mode d-flex align-items-center">
<div class="product__view--mode__list product__short--by align-items-center d-none d-lg-flex">
<label class="product__view--label">Sırala : <?php echo $_GET["orderby"] == 'date' ? 'selected' : null; ?> </label>
<div class="select shop__header--select">
<select class="product__view--select" onchange="window.location.href=this.value;">
<option value="<?php echo $url = 'https://'.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']; ?>">Varsayılan Sıralama</option>
<option <?php echo !g('orderby') == "price" ? 'selected' : null; ?> value="?orderby=price">Fiyat: Düşükten Yükseğe</option>
<option <?php echo !g('orderby') == "price-desc" ? 'selected' : null; ?> value="?orderby=price-desc">Fiyat: Yüksekten Düşüğe</option>
<option <?php echo $_GET['orderby'] == "date" ? 'selected' : null; ?> value="?orderby=date">Tarih: Son eklenenler</option>
<option <?php echo g('orderby') == "rating" ? 'selected' : null; ?> value="?orderby=rating">En çok ziyaret edilen</option>
</select>
</div>
</div>
</div>function temiz($text)
{
$text = strip_tags($text);
$text = preg_replace('/<a\s+.*?href="([^")]+)"[^>]*>([^<]+)<\/a>/is', '\2 (\1)', $text);
$text = preg_replace('/<!--.+?-->/', '', $text);
$text = preg_replace('/{.+?}/', '', $text);
$text = preg_replace('/ /', ' ', $text);
$text = preg_replace('/&/', ' ', $text);
$text = preg_replace('/"/', ' ', $text);
$text=htmlspecialchars($text);
$text=addslashes($text);
return $text;
}
function g($par){
$par = temiz($_GET[$par]);
return $par;
}r10.net'de ilk paylaşımım hatalarımdan ötürü özür dilerim.