Hi,
This is my function:
<pre><html>
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-15">
<title>OpenLayers: Google Layer Example</title>
<link rel="stylesheet" href="http://openlayers.org/api/theme/default/style.css" type="text/css" />
<link rel="stylesheet" href="http://openlayers.org/dev/examples/style.css" type="text/css" />
<!-- this gmaps key generated for http://geoserver.e.florasul.pt:8080/geoserver/ -->
<script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAA9g9Gyhn_sxqfjeV5VmcEgBSQW2MnFpcs8J7iF2tReTA-lhmzIRSSMs_ZN_i7TfRlNhvx1kGWWYvHzw&amp;language=pt-PT"></script>
<script src="http://openlayers.org/api/OpenLayers.js"></script>
<script type="text/javascript">
var map;
function init() {
// Create the map object
map = new OpenLayers.Map('map');
                
// Create a Google layer
var gmap = new OpenLayers.Layer.Google(
"Google Streets", // the default
{numZoomLevels: 100}
);
                // create Google Satellite layer
var gsat = new OpenLayers.Layer.Google(
"Google Satellite", //
{type: G_SATELLITE_MAP,}
);
// Add layer to map
                map.addLayers([gmap,gsat]);
                map.addControl(new OpenLayers.Control.LayerSwitcher());
                
// Zoom to Portugal
map.setCenter(new OpenLayers.LonLat(-8, 39.6), 6.85);
                
                
}
        
function drc_filter(drc_value){
if (drc_value == '') {alert ('DRC'); return false;}
else {
var drc_value_stage1 = drc_value;
var drc_value_stage2 = drc_value_stage1.replace("/","'");
var drc_value_stage3 = drc_value_stage2.replace("/","'");
//Initialize WMS layer from our local GeoServer
var bwms = new OpenLayers.Layer.WMS( "CAOP",
"http://xxx:8080/geoserver/wms",
{
CQL_FILTER:drc_value_stage2,
"transparent":"true",
"layers":"s:c_wgs",
"format":"image/png"},
{"reproject":"true"}
);
map.addLayer(bwms);
var re = new OpenLayers.Layer.WMS( "Red",
"http://xxx:8080/geoserver/wms",
{
CQL_FILTER:drc_value_stage2,
"transparent":"true",
"layers":"s:r",
"format":"image/png" },
{ "reproject":"true" }
);
map.addLayer(re);
var se = new OpenLayers.Layer.WMS( "Sub",
"http://xxx:8080/geoserver/wms",
{
CQL_FILTER:drc_value_stage2,
"transparent":"true",
"layers":"s:y",
"format":"image/png" },
{ "reproject":"true" }
);
// Add WMS layer to our map
map.addLayer(se);
}
}
</script>
</head>
<body onload="init()">
<?php
$query = "SELECT * FROM c_wgs order BY conc limit 5";
$result = pg_query($query);
if (!$result) {
echo "Problem with query";
echo pg_last_error();
exit();
}
?>
<h1 id="title">OpenLayers: WEBSIG</h1>
<div style="width:40%; height:80%" id="map"></div>
<select id="drc" onchange="drcv(this.options[this.selectedIndex].value);">
<option value="">>> FILTRAR POR DRC <<</option>
<?php
while($row = pg_fetch_assoc($result)) {
                
?>
<option value='<?php echo 'dio1=/'.$row['dio1'].'/'?>'><?php echo $row['dio1'] ?></option>
<?php
}
?>
</select>
</body>
</html></pre>
I want that every time that I change the values of my select box, uptade the filter and not create a new one.
Eg:
I have 3 layer or orverlayer but every time that I change the value in select box a new layer or overlayer are created.
<img src="http://osgeo-org.1803224.n2.nabble.com/file/n6929587/layer.jpg" border="0"/>
And I just want update this 3 layers
How can I dos this ?
Andre Bolinhas
        
<br/><hr align="left" width="300" />
View this message in context: <a href="http://osgeo-org.1803224.n2.nabble.com/Update-wms-filter-tp6929587p6929587.html">Update wms filter</a><br/>
Sent from the <a href="http://osgeo-org.1803224.n2.nabble.com/OpenLayers-Users-f1822463.html">OpenLayers Users mailing list archive</a> at Nabble.com.<br/>