Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <Title>Exemplo</Title>
- </head>
- <body>
- <form action="Conecta.php" methodh="POST">
- Nome<input type="text" name="nome"/>
- E-mail<input type="email" name="email"/>
- Data de nascimento<input type="text" name="data_nasc"/>
- <input type="submit" name="Enviar"/>
- </form>
- </body>
- </html>
- <?php
- $servername = "localhost";
- $database = "Cadastro";
- $username = "Root";
- $password = "xxxxx";
- // Create connection
- $conn = mysqli_connect($servername, $username, $password, $database);
- // Check connection
- if (!$conn) {
- die("Connection failed: " . mysqli_connect_error());
- }
- echo "Connected successfully";
- // RECEBENDO OS DADOS PREENCHIDOS DO FORMULĂRIO !
- $nome = $_POST ["nome"];
- $email = $_POST ["email"];
- $data_nasc = $_POST ["data_nasc"];
- $data = date("Y-m-d",strtotime(str_replace('/','-',$data)));
- $newslleter = "INSERT INTO newslleter (nome,email,data_nasc) VALUES ('$nome','$email','$data_nasc')";
- if (mysqli_query($conn, $newslleter)) {
- echo "New record created successfully";
- } else {
- echo "Error: " . $usuarios . "<br>" . mysqli_error($conn);
- }
- mysqli_close($conn);
- ?>
Add Comment
Please, Sign In to add comment