Carrega os dados mas não passa via get
Olá a todos.
Não sei bem como explicar meu problema, mas, como sempre, só estou postando porque já vasculhei o google e o fórum aqui e não encontrei a solução.
Vamos lá... Eu utilizo os códigos abaixo para fazer uma pesquisa de 5 combos, sendo que o segundo e o terceiro são dinâmicos.
O resultado é gerado em outra página, cujos dados são enviados por get.
Está carregando os combos perfeitamente e também funciona certinho no IE. No entanto, no FF, ele carrega os combos mas não passa os dados pelo submit para mostrar o resultado da busca. Espero que dê pra entender...
Desde já agradeço muito a quem puder me orientar a como resolver o problema.
Segue os códigos, limpei toda a parte de layout que consegui, pra tentar não deixar tão longo... mas acho que não ajudou muito... http://forum.imasters.com.br/public/style_emoticons/default/blush.gif
Arquivo .js
>
req.onreadystatechange = processReqChange;
req.open("GET", url, true);
req.send(null);
} else if (window.ActiveXObject) {
try {
req = new ActiveXObject("Msxml2.XMLHTTP.4.0");
} catch(e) {
try {
req = new ActiveXObject("Msxml2.XMLHTTP.3.0");
} catch(e) {
try {
req = new ActiveXObject("Msxml2.XMLHTTP");
} catch(e) {
try {
req = new ActiveXObject("Microsoft.XMLHTTP");
} catch(e) {
req = false;
}
}
}
}
if (req) {
req.onreadystatechange = processReqChange;
req.open("GET", url, true);
req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
req.send();
}
}
}
function processReqChange() {
if (req.readyState == 4) {
if (req.status == 200) {
document.getElementById('alttipr').innerHTML = req.responseText;
} else {
alert("Houve um problema ao obter os dados:\n" + req.statusText);
}
}
}
function alttipr(valor){
loadXMLDoc("tipr.php?fin="+valor);
}
// ****************************
var req;
function loadXMLDoc3(url){
req = null;
if (window.XMLHttpRequest) {
req = new XMLHttpRequest();
req.onreadystatechange = processReqChange3;
req.open("GET", url, true);
req.send(null);
} else if (window.ActiveXObject) {
try {
req = new ActiveXObject("Msxml2.XMLHTTP.4.0");
} catch(e) {
try {
req = new ActiveXObject("Msxml2.XMLHTTP.3.0");
} catch(e) {
try {
req = new ActiveXObject("Msxml2.XMLHTTP");
} catch(e) {
try {
req = new ActiveXObject("Microsoft.XMLHTTP");
} catch(e) {
req = false;
}
}
}
}
if (req) {
req.onreadystatechange = processReqChange3;
req.open("GET", url, true);
req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
req.send();
}
}
}
function processReqChange3(){
if (req.readyState == 4) {
if (req.status == 200) {
document.getElementById("altbair").innerHTML = req.responseText;
} else {
alert("Houve um problema ao obter os dados:\n" + req.statusText);
}
}
}
function altbair(valor){
loadXMLDoc3("bair.php?tipo="+valor);
}
Arquivo que tem os combos (.php)
>
<form name='result' method='get' action='resultadob.php'>
<input type="radio" value="Residencial" name="f" **onClick='alttipr(this.value);'**>Residencial
<input type="radio" value="Comercial" name="f" **onClick='alttipr(this.value);'**>
<div id='alttipr'>
<select name="t">
<option>aguarde...</option>
</select>
div id='altbair'>
<select name="b">
<option>aguarde...</option>
</select>
<select name="mn">
<option value="i">indiferente</option>
<option value="10000">R$ 10.000</option>
</select>
<select name="mx"** onChange='result.submit()'**>
<option value="i">indiferente</option>
<option value="40000">R$ 40.000</option>
</select>
</form>
gera os dados da combo alttipr (tipr.php)
>
<?
header("Content-type: text/html; charset=ISO-8859-1");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
$file_name = 'finn.txt';
$fin = $_GET[fin];
gravar($file_name, $fin); // essa função tá ok
require "conexao.php";
echo "<select name='t' **onChange='altbair(this.value);'**>";
$resb = mysql_query("SELECT distinct tipo FROM imov WHERE fin = '$fin' AND ativo = '1' ORDER BY tipo asc");
$ret = mysql_num_rows($resb);
if ($ret >0) {
echo "<option>Selecione</option>";
while($ro1 = mysql_fetch_array($resb)){
$tipo = $ro1['tipo'];
if ($tipo == "apartamento"){ $tipo1 = "Apartamento";}
if ($tipo == "barracao"){ $tipo1 = "Barracão";}
echo "<option value='$tipo'>$tipo1</option>";
}
}
echo "</select>";
?>
>
<?
header("Content-type: text/html; charset=ISO-8859-1");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
$file_name = 'finn.txt';
$fin = ler($file_name); // esta função está ok
$tipo = $_GET['tipo'];
include "amn/cn.php";
echo "<select name='b'>";
$resb = mysql_query("SELECT distinct bairro FROM imov WHERE tipo = '$tipo' AND fin = '$fin' AND ativo = '1' ORDER BY bairro asc");
$ret = mysql_num_rows($resb);
echo "<option value=''>Selecione</option>";
while($ro1 = mysql_fetch_array($resb)){
echo "<option value='".htmlentities($ro1['bairro'])."'>".htmlentities($ro1['bairro'])."</option>";
}
echo "</select>";
?>Discussão (3)
Carregando comentários...