/ Published in: PHP
                    
                                        By using this php snippnet we can store different fields (got by array post) into a sql database
                
                            
                                Expand |
                                Embed | Plain Text
                            
                        
                        Copy this code and paste it in your HTML
 <?php $servidor="localhost"; $usuario="root"; $pass=""; $base_datos="db_amigos"; //$link=new ServerBD($servidor,$usuario,$pass,$base_datos); $nombre=$_POST['nombre']; $movil=$_POST['movil']; $mail=$_POST['mail']; $twitter=$_POST['twitter']; $consulta="INSERT INTO amigos (nombre,movil,mail,twitter) VALUES ('$nombre', '$movil', '$mail', '$twitter')"; echo "<a style=\"text-decoration:none\"; href=\"mostrar.php\">Registro insertado. Visualizar el contenido de la base</a>"; }else { echo "<h3 style=\"color:red\">Error, no ha introducido todos los datos!!</h3>"; } ?>
Comments
                    Subscribe to comments
                
                