Visualizzazione dei risultati da 1 a 2 su 2

Visualizzazione discussione

  1. #1
    Utente di HTML.it
    Registrato dal
    May 2017
    Messaggi
    1

    Da checkbox inviare a database mysql

    Buongiorno sto creando un sito dove dovrei poter fare una selezione multipla dei prodotti desiderati, come posso fare per mandare cioè che è stato selezionato al database?
    Questo è il codice html del checkbox, dovrei forse farlo in php? Se si mi potreste dire come, scusate,ma sono nuovo nel campo dell'informatica e sul forum

    codice HTML:
     <div id="main2">                <div class="wrapper">
                    <form action="" method="POST">
                        <ul>
                            <p>Panini: </p>
                            
                                $query="select * from panini order by nome";
                                $result= mysqli_query($db,$query);
                                if ($result)
                                    {
                                    while ($row = mysqli_fetch_assoc($result)) 
                                      { 
                                      echo "<input type='checkbox' name='check-box' />&nbsp".$row['nome']." - €".$row['prezzo']."<span></span><br>";
                                      }
                                    }
                            
                        </ul>
                        <ul>
                            <p>Contorni: </p>
                            
                                $query="select * from contorni order by nome";
                                $result= mysqli_query($db,$query);
                                if ($result)
                                    {
                                    while ($row = mysqli_fetch_assoc($result)) 
                                      { 
                                      echo "<input type='checkbox' name='check-box' />&nbsp".$row['nome']." - €".$row['prezzo']."<span></span><br>";
                                      }
                                    }
                            
                        </ul>
                        <ul>
                            <p>Bibite: </p>
                            
                                $query="select * from bibite order by nome";
                                $result= mysqli_query($db,$query);
                                if ($result)
                                    {
                                    while ($row = mysqli_fetch_assoc($result)) 
                                      { 
                                      echo "<input type='checkbox' name='check-box' />&nbsp".$row['nome']." - €".$row['prezzo']."<span></span><br>";
                                      }
                                    }
                            
                        </ul>                
                        <ul>
                            <p>Dolci: </p>
                            
                                $query="select * from dolci order by nome";
                                $result= mysqli_query($db,$query);
                                if ($result)
                                    {
                                    while ($row = mysqli_fetch_assoc($result)) 
                                      { 
                                      echo "<input type='checkbox' name='check-box' />&nbsp".$row['nome']." - €".$row['prezzo']."<span></span><br>";
                                      }
                                    }
                            
                        </ul>
                        <ul>
                            <p>Caffetteria: </p>
                            
                                $query="select * from caffetteria order by nome";
                                $result= mysqli_query($db,$query);
                                if ($result)
                                    {
                                    while ($row = mysqli_fetch_assoc($result)) 
                                      { 
                                      echo "<input type='checkbox' name='check-box' />&nbsp".$row['nome']." - €".$row['prezzo']."<span></span><br>";
                                      }
                                    }
                            
                        </ul>
                        <p>
                            <input type="submit" name="invia" value="SUBMIT">
                            <input type="reset" value="RESET">
                        </p>
                    </div>
                    </form>
    Ultima modifica di steade; 24-05-2017 a 11:18

Tag per questa discussione

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 © 2025 vBulletin Solutions, Inc. All rights reserved.