vendredi 9 novembre 2018

How to show a form after a conditional

I'm starting at php and I want to put a form after a conditional.

if ($_POST) {
    $busqueda = trim($_POST['buscar']);
    $entero = 0;
    if (empty($busqueda)) {
        $texto = 'Búsqueda sin resultados';
    } else {
        conectar();
        $sql = "SELECT * FROM table_2 WHERE cups LIKE '%" . $busqueda . "%' ORDER BY cups";
        $resultado = mysqli_query($conexion, $sql);
        if (mysqli_num_rows($resultado) > 0) {
            $registros = '<p>Hemos encontrado ' . mysqli_num_rows($resultado) . ' registros </p>'
            ;
            while ($fila = mysqli_fetch_assoc($resultado)) {
                $texto.= $fila['cups'] . '<br />';
            }
        } else {
            $texto = "No hay resultados en la BBDD";
        }
    } else (mysqli_num_rows($resultado) > 0) {
        echo 
             ;
    }

When it shows "Hemos encontrado X registros" I want to put a form to fill more entries to the table, but I can't find the way to do that. Sorry if this is a stupid question but I'm really noob at this!

Thanks in advance

Aucun commentaire:

Enregistrer un commentaire