Jump to content

alexndrre

New Members
  • Posts

    5
  • Joined

  • Last visited

Posts posted by alexndrre

  1. 20 hours ago, requinix said:

    Your form is going to simulador.php. Make that script process the form and decide where the user is supposed to go. The URL of the page.

    Don't output anything, only send the user to that page with

    
    header("Location: " . $url_to_send_the_user_to);
    exit;

     

     

    In fact, it directs me through the resultado.php page, because that code is included.

    <script language= "JavaScript">
    location.href="resultado.php"
    </script>
        <?php
    }    
    ?>

    I need it to indicate according to the desired option on the form.

  2. Hi guys. As I am new to PHP, I have a question.

    Necessarily, this need not be done in php, if you have something in html or js that can be done, let me know! Well, I have a form where you enter information like name, city, phone and product option. These product options include real estate and auto options. By clicking submit (to submit form), I need to direct the visitor to their chosen product option.

    For example, when I filled out the form I chose 'real estate'. When I clicked submit, it went to a page where the real estate-only content appeared.

    Note: I already have this code ready below and it already directs the information to the database. However, I don't know how to make him redirect to the customer, the product option he chose.

     

          <form action="simulador.php" method="post" name="dados" id="dados" onSubmit="return validaform()">
                <div class="col-md-5 esquerda">
                               Selecione o bem<br/>
                               <select name="tipo" type="text" class="contat3" placeholder="Selecione o bem">
                               <option value="Im�vel"" 
                               style="background-color: #fff;">Imóveis</option>
                               <option value="Autom�vel"" 
                               style="background-color: #fff;">Automóveis</option>
                               <option value="Moto" style="background-color: #fff;">Motos</option>
                              </select><br/>
                             Selecione o plano<br/>
                             <select name="plano" type="text" class="contat3">
                               <option value="Crédito"" 
                             style="background-color: #fff;">Crédito</option>
                               <option value="Parcela"" 
                             style="background-color: #fff;">Parcela</option>
                             </select><br/>
                           
                             
                             <input name="valorcon" type="text" id="valorcon" class="contat3"  placeholder="Digite o valor" maxlength="1000" /><br/>
                           
                           
                             
                             <input name="nomecon" type="text" id="nomecon" class="contat3"  placeholder="Nome"  maxlength="1000" /><br/>
                            
                        
                                           
                           
                            
                             <input name="telefone" type="text" 
    						  onkeypress="Mascara('TEL',this,event);"
    						 type="text" id="telefone" class="contat3"  placeholder="Telefone" />
    						 
    						 <!--- 
    						 <input name="tel2" type="text" id="tel2" onkeypress="Mascara('TEL',this,event);" /><br/>
    						 --->
                       
                       
                             
                             <input name="emailcon" type="text" id="emailcon" class="contat3"  placeholder="E-mail"  maxlength="1000" /><br/>
                       
                          
                           
                             <input name="cidadecon" type="text" id="cidadecon" class="contat3"  placeholder="Cidade"  maxlength="1000" />
                         
                       
                             <br/><br/><br/>
                             <a id="enviar-form" class="button solid-color" href="#">Enviar</a>
                             <input type="submit" id="enviar-form-btn" style="display: none;" />
                        
                </div>         
           </form>

     

  3. Just now, Barand said:

    … or in your environment?

    For example, an upgrade to PHP 7.0+ would cause your script to crumble (mysql_ functions obsolete)

     

     

    Just now, ginerjm said:

    Not trying to be difficult here but I want to ask - What has changed in your code?  Working scripts that suddenly don't work usually means you changed something.  Have you tried adding any kind of debugging code (echo's or writes to a text file) to track the actions that your script is taking? 

     

    No updates or changes have been made. I had not moved this part, just made a backup and it was like this.

  4. Hello people! Well, I'm working on a site that has a financing simulator that asks for your data and a value related to cars, real estate and motorcycles. When simulating, it sends you to a page, calculating the closest result and sends your data to the database. However, he has a problem now. When you try to simulate, it no longer shows the result, it even loads the table but has no content, and the simulator form quickly pops up again. Check out an example at http://vitorconsorcios.com.br/simulador.php, below has the source code of the site. I've tried everything, but this is my last solution. What could be the cause of this?

     

    <?php
    include("injection.php");
    /* if (isset($_POST['valorcon']) */
    $valorcon = (int) tira_virgula_para_ponto( $_POST['valorcon'] );
    $plano=anti_injection($_POST["plano"]);
    $tipo=anti_injection($_POST["tipo"]);
    $nomecon=anti_injection($_POST["nomecon"]);
    $telefone=anti_injection($_POST["telefone"]);
    $emailcon=anti_injection($_POST["emailcon"]);
    $cidadecon=anti_injection($_POST["cidadecon"]);
    
    if ($valorcon>0) {        
        // Inseri a procura
        $tsql = " insert simulacao set
                            plano='$plano' ,
                            tipo = '$tipo' , 
                            valor = $valorcon  ,
                            nome = '$nomecon' ,
                            telefone = '$telefone' ,
                            email = '$emailcon' ,
                            cidade = '$cidadecon' ";
        //echo $tsql;
        //exit;
        $sql_insert = fbd($tsql,"","inserir simulacao");
    
    
    ?>
    <div class="col-md-5">
                 <img src="img/simule.jpg" class="imagem" alt="Vitor Consórcios">
              </div>
              <div class="col-md-7"> 
              <h4>Confira a simualçao abaixo:</h4><br/>
    
    <table>
                <thead>
                   <tr>
                      <th>Descrição</th>
                      <th>Valor do Crédito</th>
                      <th>Valor da Parcela</th>
                      <th>Valor da Meia Parcela</th>
                      <th>Duração</th>
                   </tr>
                </thead>
                <tbody>       
    
    
    <?php
    $_SESSION['splano'] = $plano;
    $_SESSION['svalorcon'] = $valorcon;
    $_SESSION['stipo'] = $tipo ;
    
    if ($plano=='Crédito') {    
    
        $tsql = "   
        (SELECT * FROM `consulta` 
            where tipo='$tipo'  and credito>=$valorcon order by credito limit 2 ) 
        UNION (SELECT * FROM `consulta` where tipo='$tipo'  and credito<$valorcon order by credito desc limit 2 ) order by credito  
    
                            ";
    
    }   ELSE {
    
        $tsql = "   
    
        (SELECT * FROM `consulta` 
            where tipo='$tipo'  and parcela>=$valorcon order by parcela limit 2 ) 
        UNION (SELECT * FROM `consulta` where tipo='$tipo'  and parcela<$valorcon order by parcela desc limit 2 ) order by parcela  
    
                            ";
    
    
    }
    $_SESSION['sqlExecutar'] = $tsql ;
    //echo $tsql;
    //exit;
    $sql    = fbd($tsql,"","Seleciona as empresa");
    
    $num_rows = mysql_num_rows($sql);
    if ($num_rows>0) {
        ?>
    <script language= "JavaScript">
    location.href="resultado.php"
    </script>
        <?php
    }   
    ?>
    <script language= "JavaScript">
    location.href="simulador.php"
    </script>
    <?php
    while($dados= mysql_fetch_array($sql)){
    
    
        ?>
        <tr>
                      <td align="left"><? echo $dados[descricao]; ?></td>
                      <td>R$ <? echo valor_ponto_virgula( $dados["credito"] ); ?></td>
                      <td>R$ <? echo valor_ponto_virgula( $dados["parcela"] ); ?></td>
                      <td>R$ <? echo valor_ponto_virgula( $dados["parcela"]/2 ); ?></td>
                      <td><? echo $dados["duracao"] ; ?></td>
    <?php                 
    
        }       
    ?>        
    
    
    
                </tbody>
              </table>          
            </div>
           </div>
           <p>&nbsp;</p>
           <p>&nbsp;</p>
          </div>      
    <?php
    
    } ELSE {
    
    ?>
    
          <h2>SIMULE AGORA SEU CONSÓRCIO!</h2><br/><br/>
          <div class="col-md-6">
                 <img src="img/simule.jpg" class="imagem" alt="Vitor Consórcios">
          </div>
          <div class="col-md-1"></div>
          <form action="simulador.php" method="post" name="dados" id="dados" onSubmit="return validaform()">
                <div class="col-md-5 esquerda">
                               Selecione o bem<br/>
                               <select name="tipo" type="text" class="contat3" placeholder="Selecione o bem">
                               <option value="Imóvel"" 
                               style="background-color: #fff;">Imóveis</option>
                               <option value="Automóvel"" 
                               style="background-color: #fff;">Automóveis</option>
                               <option value="Moto" style="background-color: #fff;">Motos</option>
                              </select><br/>
                             Selecione o plano<br/>
                             <select name="plano" type="text" class="contat3">
                               <option value="Crédito"" 
                             style="background-color: #fff;">Crédito</option>
                               <option value="Parcela"" 
                             style="background-color: #fff;">Parcela</option>
                             </select><br/>
    
    
                             <input name="valorcon" type="text" id="valorcon" class="contat3"  placeholder="Digite o valor" maxlength="1000" /><br/>
    
    
    
                             <input name="nomecon" type="text" id="nomecon" class="contat3"  placeholder="Nome"  maxlength="1000" /><br/>
    
    
    
    
    
                             <input name="telefone" type="text" 
                              onkeypress="Mascara('TEL',this,event);"
                             type="text" id="telefone" class="contat3"  placeholder="Telefone" />
    
                             <!--- 
                             <input name="tel2" type="text" id="tel2" onkeypress="Mascara('TEL',this,event);" /><br/>
                             --->
    
    
    
                             <input name="emailcon" type="text" id="emailcon" class="contat3"  placeholder="E-mal"  maxlength="1000" /><br/>
    
    
    
                             <input name="cidadecon" type="text" id="cidadecon" class="contat3"  placeholder="Cidade"  maxlength="1000" />
    
    
                             <br/><br/><br/>
                             <a id="enviar-form" class="button solid-color" href="#">Enviar</a>
                             <input type="submit" id="enviar-form-btn" style="display: none;" />
    
                </div>         
           </form>
    
           </div>
           <p>&nbsp;</p>
           <p>&nbsp;</p>
          </div>    
    
    <?php } 
    // 14-05-2018
    ?>  
    
    
         </div>
    
        </div>

     

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.