WordPress.org

Ready to get started?Download WordPress

Forums

custom form (1 post)

  1. willmkt
    Member
    Posted 1 year ago #

    Hi, i am trying to make a form that on submit passes values to a external url and show results as an iframe. The form is the home page and the results must be shown in the first page as well.

    Everery time i submit it returns a 404 error

    here is the code:

    <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>

    and the php code:

    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>";
    }}
      ?>

    Does anyone know a solution?? i realy need to make this work... help please

Topic Closed

This topic has been closed to new replies.

About this Topic