Visualizzazione dei risultati da 1 a 3 su 3

Discussione: form dinamico

  1. #1
    Utente di HTML.it L'avatar di pheeko
    Registrato dal
    Feb 2003
    Messaggi
    99

    form dinamico

    Ho buttato giù il seguente codice:
    <?php
    $mysqli = new mysqli("localhost", "Filippo", "filippo", "test");
    if (mysqli_connect_errno()) {
    printf("Connect failed: %s\n", mysqli_connect_error());
    exit();
    }
    $select = "seldel";
    $query = "SELECT user FROM access WHERE id_user>1";
    $result = $mysqli->query($query);
    echo"<html>";
    echo"<body>";
    echo"<head>";
    echo "<form action=\"elimina.php\" method=\"post\">";
    while($row = $result->fetch_array()) {
    printf ("
    %s%s\n ",$row[0], $row[1] );
    echo"<input name=\"seldel\" type=\"checkbox\" value=\"$row[1]\" />";
    }
    echo "
    ";
    echo "<input name=\"\" type=\"submit\" />";
    echo "</form>";
    echo "</body>";
    echo "</html>";
    $result->free();
    $mysqli->close();
    ?>

    La variabile la recupero così:
    <?php
    echo $_POST['seldel'];
    ?>

    il form viene creato ma al momento dell'invio non passa la variabile, ovviamente è sbagliato, dove?
    MORITURI TE SALUTANT

  2. #2
    Utente di HTML.it L'avatar di thitan
    Registrato dal
    Feb 2001
    Messaggi
    716
    codice:
    echo"<html>";
    echo"<body>";
    echo"<head>";
    echo "<form action=\"hex.php\" method=\"post\" name=\"form1\" id=\"form\">";
    echo"<input name=\"seldel\" type=\"checkbox\" value=\"ulla\" />";
    echo "
    ";
    echo "<input name=\"Submit\" type=\"submit\" />";
    echo "</form>";
    echo "</body>";
    echo "</html>";
    così funziona. (ho aggiunto il campo name nel form e nel submit)

    www.inter-rail.it
    travellers, not tourist
    Is cuma cá mhinice a théann tú ar strae; is é is tábhachtaí gurb áil leat do bhealach a aimsiú arís.

  3. #3
    Utente di HTML.it L'avatar di pheeko
    Registrato dal
    Feb 2003
    Messaggi
    99
    Grazie mille, mi sei stato di grande aiuto!
    MORITURI TE SALUTANT

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.