___ ___ erkimt Error: Notice: Undefined index: d1 ___ ______ ___ azszpr297395

%code% was the %code% % without value, use:

%pre%

Using %code% all parameters passed to the file %code% of% %code% should be as %code% , for example, here is correct:

%pre%

But here, with this %code% %:

%pre%

But as the %code% has been defined previously, simply do %code% %:

%pre%

If by %code% %:

%pre% %pre%
    
___

1
___ ___ erkimt Error: Notice: Undefined index: d1 ___ ______ ___ azszpr297395

<form action="action.php" method="POST"> was the %code% % without value, use:

<div class="conainer">
  <div class="card mx-auto w-100">
    <div class="card-header">
        <h5 style="color:#007BFF;">Molas de compressão Pesquisa</h5>
    </div>
    <div class="card-body">
      <form action="action.php" method="POST">
        Referencia:
        <input type="text" placeholder="&#xF002; Search" name="referencia"style="font-family:Arial, FontAwesome">
        <br><br>
        <div class="row">
          Diametro do Aço (d):
          <div class="col-md-4">
            <input type="text" name="d1" size="6" placeholder="min"> 
            <input type="text" name="d2"  size="6" placeholder="max">
          </div>
          Comprimento total (L0):
          <div class="col-md-4">
            <input type="text" name="comp1"  size="6" placeholder="min"> 
            <input type="text" name="comp2"  size="6" placeholder="max">
          </div>
        </div>
        <br>
        <div class="row">
          Diametro Exterior (DE):
          <div class="col-md-4">
            <input type="text" size="6" name="de1" placeholder="min"> 
            <input type="text" name="de2" size="6" placeholder="max">
          </div>
          Passo (P):
          <div class="col-md-4">
            <input type="text" name="passo1" size="6" placeholder="min"> 
            <input type="text" name="passo2" size="6" placeholder="max">
          </div>
          <br>
        </div>
        <br>
        <div class="row">
          <div class="form-group">
            <label for="exampleFormControlSelect1">Ordenar por:</label>
            <select class="form-control" name="ordenar">
              <option>Referencia</option>
              <option>Diametro do Aço (d)</option>
              <option>Comprimento total (L0)</option>
              <option>Diametro Exterior (DE)</option>
              <option>Passo (P)</option>
            </select>
          </div>
          <div class="col-md-9">
            <div align="right">
              <img src="imagens/desenho33.png" align="right" height="250" width="350" >
            </div>
          </div>
        </div>
        <br>
        <div align="right">
          <button type="reset" align="right" class="btn btn-primary">Reset</button>
          <button type="submit" align="right" class="btn btn-primary">Continuar</button>   
        </div>
      </form>
    </div>
  </div>
</div>
<br>
<div class="jumbotron">
  <div class="container-fluid">
    <div class="row">
      <div class="col-md-1">Referência</div>
      <div class="col-md-2">Diametro do Aço (DE)</div>
      <div class="col-md-2">Comprimento Total (L0)</div>
      <div class="col-md-2">Diametro Exterior</div>
      <div class="col-md-1">Passo</div>
      <div class="col-md-1">Preço</div>
      <div class="col-md-1"></div>
    </div>
  </div>
</div>
<div id="get_product"></div>

Using %code% all parameters passed to the file %code% of% %code% should be as %code% , for example, here is correct:

<?php


$d1=$_POST["d1"];
$d2=$_POST["d2"];
$comp1=$_POST["comp1"];
$comp2=$_POST["comp2"];
$de1=$_POST["de1"];
$de2=$_POST["de2"];
$passo1=$_POST["passo1"];
$passo2=$_POST["passo2"];
$ordenar=$_POST["ordenar"];


include ("db.php");



if(isset($_POST["getproduct"])){
    $ordenar="nome";
}
else{
$ordenar=$_GET["ordenar"];		
}
switch($ordenar){
case "referencia":
	$ordenar_por="order by referencia";	
case "diametroaco":
	$ordenar_por="order by diametroaco";	
case "comprimentototal":
	$ordenar_por="order by comprimentototal";	
case "diametroexterior":
	$ordenar_por="order by diametroexterior";
case "passo":
	$ordenar_por="order by passo";
}
    
    // $molcomp_query="SELECT * FROM stock_comp";
    $molcomp_query="select * from stock_comp where diametroaco BETWEEN '".$d1."' and '".$d2."' $ordenar_por";
   $run_query = mysqli_query($con,$molcomp_query);
    if (mysqli_num_rows($run_query) > 0){
        while($row = mysqli_fetch_array($run_query)){
        $id_mol_comp=$row['id_mol_comp'];
        $referencia=$row['referencia'];
        $diametroaco=$row['diametroaco'];
        $comprimentototal=$row['comprimentototal'];
        $diametroexterior=$row['diametroexterior'];
        $passo=$row['passo'];
        $preco=$row['preco']; 

           echo"
            <div class='card mx-auto w-100'>
  <div class='card-body'>
   <div class='row'>
                <div class='col-md-1'>$referencia</div>
                <div class='col-md-2'>$diametroaco</div>
                <div class='col-md-2'>$comprimentototal</div>
                <div class='col-md-2'>$diametroexterior</div>
                <div class='col-md-1'>$passo</div>
                <div class='col-md-1'>$preco</div>
                <div class='col-md-1'><i style='font-size:30px' class='fa'>&#xf1c1;</i>  <i style='font-size:30px' class='fa'>&#xf217;</i>   </div>
                </div>
</div>
</div>
<br>
";
        }
    }



?>

But here, with this %code% %:

<div class="conainer">
  <div class="card mx-auto w-100">
    <div class="card-header">
        <h5 style="color:#007BFF;">Molas de compressão Pesquisa</h5>
    </div>
    <div class="card-body">
      <form action="action.php" method="POST">
        Referencia:
        <input type="text" placeholder="&#xF002; Search" name="referencia"style="font-family:Arial, FontAwesome">
        <br><br>
        <div class="row">
          Diametro do Aço (d):
          <div class="col-md-4">
            <input type="text" name="d1" size="6" placeholder="min"> 
            <input type="text" name="d2"  size="6" placeholder="max">
          </div>
          Comprimento total (L0):
          <div class="col-md-4">
            <input type="text" name="comp1"  size="6" placeholder="min"> 
            <input type="text" name="comp2"  size="6" placeholder="max">
          </div>
        </div>
        <br>
        <div class="row">
          Diametro Exterior (DE):
          <div class="col-md-4">
            <input type="text" size="6" name="de1" placeholder="min"> 
            <input type="text" name="de2" size="6" placeholder="max">
          </div>
          Passo (P):
          <div class="col-md-4">
            <input type="text" name="passo1" size="6" placeholder="min"> 
            <input type="text" name="passo2" size="6" placeholder="max">
          </div>
          <br>
        </div>
        <br>
        <div class="row">
          <div class="form-group">
            <label for="exampleFormControlSelect1">Ordenar por:</label>
            <select class="form-control" name="ordenar">
              <option>Referencia</option>
              <option>Diametro do Aço (d)</option>
              <option>Comprimento total (L0)</option>
              <option>Diametro Exterior (DE)</option>
              <option>Passo (P)</option>
            </select>
          </div>
          <div class="col-md-9">
            <div align="right">
              <img src="imagens/desenho33.png" align="right" height="250" width="350" >
            </div>
          </div>
        </div>
        <br>
        <div align="right">
          <button type="reset" align="right" class="btn btn-primary">Reset</button>
          <button type="submit" align="right" class="btn btn-primary">Continuar</button>   
        </div>
      </form>
    </div>
  </div>
</div>
<br>
<div class="jumbotron">
  <div class="container-fluid">
    <div class="row">
      <div class="col-md-1">Referência</div>
      <div class="col-md-2">Diametro do Aço (DE)</div>
      <div class="col-md-2">Comprimento Total (L0)</div>
      <div class="col-md-2">Diametro Exterior</div>
      <div class="col-md-1">Passo</div>
      <div class="col-md-1">Preço</div>
      <div class="col-md-1"></div>
    </div>
  </div>
</div>
<div id="get_product"></div>

But as the %code% has been defined previously, simply do %code% %:

<?php


$d1=$_POST["d1"];
$d2=$_POST["d2"];
$comp1=$_POST["comp1"];
$comp2=$_POST["comp2"];
$de1=$_POST["de1"];
$de2=$_POST["de2"];
$passo1=$_POST["passo1"];
$passo2=$_POST["passo2"];
$ordenar=$_POST["ordenar"];


include ("db.php");



if(isset($_POST["getproduct"])){
    $ordenar="nome";
}
else{
$ordenar=$_GET["ordenar"];		
}
switch($ordenar){
case "referencia":
	$ordenar_por="order by referencia";	
case "diametroaco":
	$ordenar_por="order by diametroaco";	
case "comprimentototal":
	$ordenar_por="order by comprimentototal";	
case "diametroexterior":
	$ordenar_por="order by diametroexterior";
case "passo":
	$ordenar_por="order by passo";
}
    
    // $molcomp_query="SELECT * FROM stock_comp";
    $molcomp_query="select * from stock_comp where diametroaco BETWEEN '".$d1."' and '".$d2."' $ordenar_por";
   $run_query = mysqli_query($con,$molcomp_query);
    if (mysqli_num_rows($run_query) > 0){
        while($row = mysqli_fetch_array($run_query)){
        $id_mol_comp=$row['id_mol_comp'];
        $referencia=$row['referencia'];
        $diametroaco=$row['diametroaco'];
        $comprimentototal=$row['comprimentototal'];
        $diametroexterior=$row['diametroexterior'];
        $passo=$row['passo'];
        $preco=$row['preco']; 

           echo"
            <div class='card mx-auto w-100'>
  <div class='card-body'>
   <div class='row'>
                <div class='col-md-1'>$referencia</div>
                <div class='col-md-2'>$diametroaco</div>
                <div class='col-md-2'>$comprimentototal</div>
                <div class='col-md-2'>$diametroexterior</div>
                <div class='col-md-1'>$passo</div>
                <div class='col-md-1'>$preco</div>
                <div class='col-md-1'><i style='font-size:30px' class='fa'>&#xf1c1;</i>  <i style='font-size:30px' class='fa'>&#xf217;</i>   </div>
                </div>
</div>
</div>
<br>
";
        }
    }



?>

If by %code% %:

%pre% %pre%
    
___
asked by anonymous 09.05.2018 / 11:49

1 answer

1
___ ___ erkimt Error: Notice: Undefined index: d1 ___ ______ ___ azszpr297395

<select> was the <option> % without value, use:

<select class="form-control" name="ordenar">
    <option value="referencia">Referencia</option>
    <option value="diametroaco">Diametro do Aço (d)</option>
    <option value="comprimentototal">Comprimento total (L0)</option>
    <option value="diametroexterior">Diametro Exterior (DE)</option>
    <option value="passo">Passo (P)</option>
</select>

Using <form method="POST"> all parameters passed to the file PHP of% action="action.php" should be as $_POST , for example, here is correct:

$d1=$_POST["d1"];
$d2=$_POST["d2"];
$comp1=$_POST["comp1"];
$comp2=$_POST["comp2"];
$de1=$_POST["de1"];
$de2=$_POST["de2"];
$passo1=$_POST["passo1"];
$passo2=$_POST["passo2"];
$ordenar=$_POST["ordenar"];

But here, with this $_GET %:

if(isset($_POST["getproduct"])){
    $ordenar="nome";
}else{
    **$ordenar=$_GET["ordenar"];**
}

But as the $ordenar has been defined previously, simply do if() %:

if(isset($_POST["getproduct"])){
    $ordenar="nome";
}

If by $.ajax() %:

$('#send').click(function(){
    var arr = [];
    $.each($('input[type="text"]'),function(){
        var key = $(this).attr('name');
        arr[key] = $(this).val();
    });
    arr['ordenar']=$('#ordenar option:selected').val();
    $.ajax({
        type:"POST",
        url:"action.php",
        data:arr,
        success:function(callback){
            $('#get_product').html(callback);
        }
    });
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script><divclass="conainer">
    <div class="card mx-auto w-100">
        <div class="card-header">
            <h5 style="color:#007BFF;">Molas de compressão Pesquisa</h5>
        </div>
        <div class="card-body">
            <section>
                Referencia:
                <input type="text" placeholder="&#xF002; Search" name="referencia"style="font-family:Arial, FontAwesome">
                <br><br>
                <div class="row">
                    Diametro do Aço (d):
                    <div class="col-md-4">
                        <input type="text" name="d1" size="6" placeholder="min"> 
                        <input type="text" name="d2"  size="6" placeholder="max">
                    </div>
                    Comprimento total (L0):
                    <div class="col-md-4">
                        <input type="text" name="comp1"  size="6" placeholder="min"> 
                        <input type="text" name="comp2"  size="6" placeholder="max">
                    </div>
                </div>
                <br>
                <div class="row">
                    Diametro Exterior (DE):
                    <div class="col-md-4">
                        <input type="text" size="6" name="de1" placeholder="min"> 
                        <input type="text" name="de2" size="6" placeholder="max">
                    </div>
                    Passo (P):
                    <div class="col-md-4">
                        <input type="text" name="passo1" size="6" placeholder="min"> 
                        <input type="text" name="passo2" size="6" placeholder="max">
                    </div>
                    <br>
                </div>
                <br>
                <div class="row">
                    <div class="form-group">
                        <label for="exampleFormControlSelect1">Ordenar por:</label>
                        <select class="form-control" name="ordenar" id="ordenar">
                            <option value="referencia">Referencia</option>
                            <option value="diametroaco">Diametro do Aço (d)</option>
                            <option value="comprimentototal">Comprimento total (L0)</option>
                            <option value="diametroexterior">Diametro Exterior (DE)</option>
                            <option value="passo">Passo (P)</option>
                        </select>
                    </div>
                    <div class="col-md-9">
                        <div align="right">
                            <img src="imagens/desenho33.png" align="right" height="250" width="350" >
                        </div>
                    </div>
                </div>
                <br>
                <div align="right">
                    <button type="reset" align="right" class="btn btn-primary">Reset</button>
                    <button align="right" class="btn btn-primary" id="send">Continuar</button>   
                </div>
            </section>
        </div>
    </div>
</div>
<br>
<div class="jumbotron">
    <div class="container-fluid">
        <div class="row">
            <div class="col-md-1">Referência</div>
            <div class="col-md-2">Diametro do Aço (DE)</div>
            <div class="col-md-2">Comprimento Total (L0)</div>
            <div class="col-md-2">Diametro Exterior</div>
            <div class="col-md-1">Passo</div>
            <div class="col-md-1">Preço</div>
            <div class="col-md-1"></div>
        </div>
    </div>
</div>
<div id="get_product"></div>
    
___
09.05.2018 / 12:55