0
Good morning, everyone,
I need to pull data from the database, but wanted the user to be able to choose from which data value to search.
My code html:
<head>
<title></title>
</head>
<body>
<form method="POST" name="frmBusca" action="Exibindo.php">
Pesquisar pedido:<input type="text" name="busca" id="busca">
<input type="submit" value="Buscar" name="buscar">
<select name="opcao">
<option>Numero bl</option>
<option>Conteiner</option>
</select>
</form>
</body>
Now there in the php:
<?php
$conexao = mysql_connect("localhost", "root", "") or die(mysql_error());
$banco = mysql_select_db("cliente_svn") or die(mysql_error());
$busca = $_POST['busca'];
$opcao = $_POST['opcao'];
case ($opcao = "Numero bl"):
I wanted to know the correct format to call the case.
Thank you!
could post the code
HTMLand the part where you request it with thePHPin the database ?– PululuK
I’m trying to post the HTML but it’s compiling the code!
– erikasena
<!DOCTYPE html> <html> <head> <title></title> </head> <body> <form method="POST" name="frmBusca" action="Displaying.php"> Search request:<type input="text" name="search" id="search"> <input type="Submit" value="Search name"> <select name="option"> <option>Number Bl</option> <option>Container</option> </select> </form> </body> </html>
– erikasena
a piece of php
– erikasena
$query_select = "SELECT * FROM new_request WHERE num_bl = '$search'"; $select = mysql_query($query_select,$connected); if ($select) { echo "<form class='col_md_16'>"; echo "<label>Container listing</label> <table class='table-Erika'><tr><td>Container</td> <td>Size</td> <td>Weight</td> </tr>"; while ($escrever = mysql_fetch_array($select)) { echo "<tr><td>". $escrever['conteiner']." </td><td>". $escrever['tamanho_cont']." </td><td>". $write['peso_cont']." </td></tr>";
– erikasena
What’s wrong with your code? What doesn’t work ?
– PululuK
I didn’t quite understand your question, but you should make some adjustments to your code, for example, the
inputsearch has thenameseek, but in thephpyou try to catch with thePOSTsearch. And theiroptionsin theselectare withoutvalue.– Augusto
I edited my question there, see if now you can understand.
– erikasena