how to get a value from an input text?

0

Inside this input there is an ID number, I would use this ID to do a search in the database. how do I get this ID that is in an input text and "game" in php so I use it as a search? should one do something like this? below:

                    <form method="get" action="">
                        Valor ID <input type="text" name="id-da-tabela-para-modal" id="id-da-tab-para-modal">
                    </form>

For now it looks like this:

                <div class="modal-body">                        
                        Valor ID <input type="text" name="id-da-tabela-para-modal" id="id-da-tab-para-modal">                       
                    <?php
                    require('conexao.php');
                    $id = $_GET['id-da-tab-para-modal'];
                    $resultado = mysql_query("select * from jogo Where ID=$id");
                    echo "<table class='table'>".
                        "<thead>".
                        "<tr>".
                        "<td>ID</td>".
                        "<td>Nome</td>".
                        "<td>Conta</td>".
                        "<td>Resultado</td>".
                        "<td>Valor Digitado</td>".
                        "<td>Dificuldade</td>".
                        "<td>Score</td>".
                        "</tr>".
                        "</thead>";
                    echo "<tbody>";
                    while($valores=mysql_fetch_array($resultado)){
                        echo "<tr>".
                            "<td>".$valores['ID']."</td>".
                            "<td>".$valores['nome']."</td>".
                            "<td>".$valores['conta']."</td>".
                            "<td>".$valores['resultado']."</td>".
                            "<td>".$valores['dificuldade']."</td>".
                            "<td>".$valores['totalacertos']."</td>".
                            "</tr>";
                    }
                    echo "</tbody></table>";
                    @mysql_close(conexao);
                    ?>
                </div>

It's not working.

    
asked by anonymous 23.03.2015 / 01:33

1 answer

4

You wrote:

$id = $_GET['id-da-tab-para-modal'];

It's actually

$id = $_GET['id-da-tabela-para-modal'];

After all, the name parameter of your input is id-from-table-to-modal

    
23.03.2015 / 01:49