我正在尝试制作一个在提交时将值传递给外部 URL 并将结果显示为 iframe 的表单。表格是主页,结果也必须显示在第一页。
每次我提交它都会返回一个 404 错误。
这是代码:
<form id="buscaAereo" method="POST" name="formularioAereo" action="<?php echo home_url('/' ); ?>">
<fieldset>
<div class="half">
<label class="radio">
<input type="radio" name="idaevolta" id="idaevolta" value="1" checked>
Ida e Volta
</label>
</div>
<div class="half">
<label class="radio">
<input type="radio" name="idaevolta" id="idaevolta" value="2" checked>
So ida
</label>
</div>
<div class="half">
<label for="name">Origem:</label>
<input type="text" class="cidade" name="origem" data-provide="typeahead">
</div>
<div class="half">
<label for="name">Destino:</label>
<input type="text" id="cidade" name="destino" data-provide="typeahead">
</div>
<div class="half">
<label for="name">Data de ida:</label>
<div class="input-prepend">
<span class="add-on"><i class="icon-calendar"></i></span>
<input class="sapn1" id="date" name="ida" type="text">
</div>
</div>
<div class="half">
<label for="name">Data de volta:</label>
<div class="input-prepend">
<span class="add-on"><i class="icon-calendar"></i></span>
<input class="" id="date" name="volta" type="text">
</div>
</div>
<div class="quarter">
<label for="country">Adultos:</label>
<select id="country" name="adultos">
<option value="0">00</option>
<option value="1" selected="selected">01</option>
<option value="2">02</option>
<option value="3">03</option>
<option value="4">04</option>
<option value="5">05</option>
<option value="6">06</option>
<option value="7">07</option>
<option value="8">08</option>
<option value="9">09</option>
</select>
</div>
<div class="quarter">
<label for="country">Criancas:</label>
<select id="country" name="criancas">
<option value="1" selected="selected">00</option>
<option value="1">01</option>
<option value="2">02</option>
<option value="3">03</option>
<option value="4">04</option>
<option value="5">05</option>
<option value="6">06</option>
<option value="7">07</option>
<option value="8">08</option>
<option value="9">09</option>
</select>
</div>
<div class="quarter">
<label for="country">Bebes:</label>
<select id="country" name="bebes">
<option value="1" selected="selected">00</option>
<option value="1">01</option>
<option value="2">02</option>
<option value="3">03</option>
<option value="4">04</option>
<option value="5">05</option>
<option value="6">06</option>
<option value="7">07</option>
<option value="8">08</option>
<option value="9">09</option>
</select>
</div>
<div class="quarter">
<input type="submit" id="busca" name="submit" class="btn btn-primary botao" value="Pesquizar">
</div>
</fieldset>
</form>
和 PHP 代码:
function buscaPassagem() {
if(isset($_POST['submit'])) {
$idaevolta = $_POST["idaevolta"];
$origem = $_POST["origem"];
$destino = $_POST["destino"];
$ida = $_POST["ida"];
$volta = $_POST["volta"];
$adultos = $_POST["adultos"];
$criancas = $_POST["criancas"];
$bebes = $_POST["bebes"];
$link = "http://www.portaldoagente.com.br/OTAFrame/SuiteAerea/guiAereoAeroportos.aspx?PesquisaAutomatica=S&Tipo=";
$UrlFinal = $link
.$idaevolta
."&Origem=".$origem
."&Destino=".$destino
."&Adultos=".$adultos
."&Criancas=".$criancas
."&Bebes=".$bebes
."&DataIda=".$ida
."&DataVolta=".$bebes
."&LojaChave=bG9qYXRlbXBvc3Jpbw==";
echo "<script>window.open('$UrlFinal', 'meu_frame');</script>";
}
}
有谁知道解决方案?