Help with combos boxes Database in php in two forms!

0

Is there any way to use two combo boxes to vary one of the other type in this example (Two combo boxes where one varies the other using 2 forms cant use ajax);

Thisismydatabase(Mydatabase)

<!DOCTYPEhtml>/*<html><head><title>Marcar</title><metacharset="utf-8"/>
</head>
<body>
<?php
if(isset($_POST['submit']))
{
    include("config.php");
    $Marca=$_POST['Marca'];
    $Modelo=$_POST['Modelo'];
    $Data=$_POST['Data'];
    $tipo=$_POST['tipo'];
      $Email=$_POST['Email'];
if(empty($Marca) ||empty($Modelo)||empty($Data)
    )
{
    echo "Deve porencher todos os valores";
}
else{
    $insert_values=$mysqli->query("insert into consulta(Email,Marca,Modelo,Tipo,Data) 
        values('$Email','$Marca','$Modelo','$tipo','$Data')");
    if($insert_values)
    {
        echo "<h3>Registo inserido</h3>";
    }
    else
    {
        die('Erro:(' .$mysqli->errno. ')'.$mysqli->error);
    }

}
}
?>
<form method="post" enctype="multipart/form-data">
Marca: <select name="Marca" id="Marca">             
   <?php
    include "config.php";
    $results=$mysqli->query("SELECT id_Marca, Marca FROM marcas");
    while($row=$results->fetch_array()){                                                 
       echo "<option value='".$row['Marca']."'>".$row['Marca']."</option>";
    }
?>

            </select> <br> <br>


Modelo: <select name="Modelo" id="Modelo">
<?php
     $results=$mysqli->query("SELECT id_Modelo,Modelo FROM modelos /*where id_Modelo like $results3*/ ");
    while($row=$results->fetch_array()){                                                 
       echo "<option value='".$row['Modelo']."'>".$row['Modelo']."</option>";
    }
    echo $results3;
?>
            </select> <br> <br>
            Tipo Prob: <input type="text" name="tipo"  id="tipo"/>
            <br>
            Data Consulta:  <input type="text" name="Data"  value="<?php echo date('Y-m-d'); ?>" id="Data" />
            <br>
             Email: <input type="text" name="Email"  id="Email"/>
            <br>
<input type="submit" value="Guardar" name="submit"/>
</form>
</body>
</html>
    
asked by anonymous 08.06.2017 / 16:40

0 answers